mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-07-25 21:24:50 +02:00
throttle
This commit is contained in:
@@ -94,6 +94,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
import { ref, useTemplateRef, watch, onMounted, onUnmounted, reactive, nextTick, shallowRef, computed, triggerRef, markRaw } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { FURNITURE_SCHEMA_DEFS } from 'misskey-world/src/room/furniture-schema-defs.js';
|
||||
import { throttle } from 'throttle-debounce';
|
||||
import XItem from './room.add-furniture-dialog.item.vue';
|
||||
import type { PreviewEngineControllerOptions } from '@/world/room/previewEngineController.js';
|
||||
import type { RoomAttachments } from 'misskey-world/src/room/type.js';
|
||||
@@ -247,10 +248,10 @@ watch(selectedId, (newId) => {
|
||||
}
|
||||
});
|
||||
|
||||
function updateFurnitureOption(k: string, v: any) {
|
||||
const updateFurnitureOption = throttle(100, (k: string, v: any) => {
|
||||
controller.updateFurnitureOption(k, deepClone(v), attachments);
|
||||
selectedFunitureOptionsState.value![k] = v;
|
||||
}
|
||||
});
|
||||
|
||||
function ok() {
|
||||
if (selectedId.value == null) return;
|
||||
|
||||
@@ -170,6 +170,7 @@ import { FURNITURE_SCHEMA_DEFS } from 'misskey-world/src/room/furniture-schema-d
|
||||
import { useInterval } from '@@/js/use-interval.js';
|
||||
import { url } from '@@/js/config.js';
|
||||
import { getDefaultCustomMadoriEnvOptions, getDefaultJapaneseEnvOptions, getDefaultMuseumEnvOptions, getDefaultSimpleEnvOptions } from 'misskey-world/src/room/env.js';
|
||||
import { throttle } from 'throttle-debounce';
|
||||
import XEnvOptions from './room.env-options.vue';
|
||||
import XOverlayPanel from './OverlayPanel.vue';
|
||||
import type { RoomControllerOptions } from '@/world/room/controller.js';
|
||||
@@ -452,10 +453,10 @@ function showSnappingMenu(ev: PointerEvent) {
|
||||
}], ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
||||
function updateFurnitureOption(k: string, v: any) {
|
||||
const updateFurnitureOption = throttle(100, (k: string, v: any) => {
|
||||
// TODO: podtMrssageのコスト削減のためattachmentsは更新がある場合のみ送る
|
||||
controller.updateFurnitureOption(controller.selected.value.furnitureId, k, deepClone(v), attachments);
|
||||
}
|
||||
});
|
||||
|
||||
async function addFuniture(ev: PointerEvent) {
|
||||
// 重いので止める
|
||||
|
||||
Reference in New Issue
Block a user