本文整理汇总了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);
}
});