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