本文整理匯總了TypeScript中tinymce/core/api/util/Delay.debounce函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript debounce函數的具體用法?TypeScript debounce怎麽用?TypeScript debounce使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了debounce函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: updateCount
const setup = (editor: Editor) => {
const debouncedUpdate = Delay.debounce(() => updateCount(editor), 300);
editor.on('init', () => {
updateCount(editor);
Delay.setEditorTimeout(editor, () => {
editor.on('SetContent BeforeAddUndo Undo Redo keyup', debouncedUpdate);
}, 0);
});
};
示例2: function
const setup = function (editor, toggleState) {
const debouncedToggle = Delay.debounce(function () {
VisualChars.toggle(editor);
}, 300);
if (editor.settings.forced_root_block !== false) {
editor.on('keydown', function (e) {
if (toggleState.get() === true) {
e.keyCode === 13 ? VisualChars.toggle(editor) : debouncedToggle();
}
});
}
};
示例3: function
editor.on('init', function () {
const statusbar = editor.theme.panel && editor.theme.panel.find('#statusbar')[0];
const debouncedUpdate = Delay.debounce(update, 300);
if (statusbar) {
Delay.setEditorTimeout(editor, function () {
statusbar.insert({
type: 'label',
name: 'wordcount',
text: wordsToText(editor),
classes: 'wordcount',
disabled: editor.settings.readonly
}, 0);
editor.on('setcontent beforeaddundo undo redo keyup', debouncedUpdate);
}, 0);
}
});