本文整理汇总了TypeScript中tinymce/core/api/util/Delay.throttle函数的典型用法代码示例。如果您正苦于以下问题:TypeScript throttle函数的具体用法?TypeScript throttle怎么用?TypeScript throttle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了throttle函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const bindContextualToolbarsEvents = function (editor: Editor, panel: InlitePanel) {
const throttledTogglePanel = Delay.throttle(togglePanel(editor, panel), 0);
const throttledTogglePanelWhenNotInForm = Delay.throttle(ignoreWhenFormIsVisible(editor, panel, togglePanel(editor, panel)), 0);
const reposition = repositionPanel(editor, panel);
editor.on('blur hide ObjectResizeStart', panel.hide);
editor.on('click', throttledTogglePanel);
editor.on('nodeChange mouseup', throttledTogglePanelWhenNotInForm);
editor.on('ResizeEditor keyup', throttledTogglePanel);
editor.on('ResizeWindow', reposition);
DOMUtils.DOM.bind(Env.container, 'scroll', reposition);
editor.on('remove', function () {
DOMUtils.DOM.unbind(Env.container, 'scroll', reposition);
panel.remove();
});
editor.shortcuts.add('Alt+F10,F10', '', panel.focus);
};
示例2: function
suite.asyncTest('throttle', function (_, done) {
let fn;
const args = [];
fn = Delay.throttle(function (a) {
args.push(a);
}, 0);
fn(1);
fn(2);
Delay.setTimeout(function () {
LegacyUnit.deepEqual(args, [2]);
done();
}, 10);
});