本文整理汇总了TypeScript中@ephox/katamari.Throttler.first方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Throttler.first方法的具体用法?TypeScript Throttler.first怎么用?TypeScript Throttler.first使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/katamari.Throttler
的用法示例。
在下文中一共展示了Throttler.first方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const setup = function (editor) {
const renderFocusCaret = Throttler.first(function () {
if (!editor.removed) {
const caretRange = CefUtils.renderRangeCaret(editor, editor.selection.getRng());
editor.selection.setRng(caretRange);
}
}, 0);
editor.on('focus', function () {
renderFocusCaret.throttle();
});
editor.on('blur', function () {
renderFocusCaret.cancel();
});
};
示例2: function
const register = function (editor) {
const throttledStore = Throttler.first(function () {
SelectionBookmark.store(editor);
}, 0);
if (editor.inline) {
registerPageMouseUp(editor, throttledStore);
}
editor.on('init', function () {
registerEditorEvents(editor, throttledStore);
});
editor.on('remove', function () {
throttledStore.cancel();
});
};
示例3: function
const setup = function (editor) {
const renderFocusCaret = Throttler.first(function () {
if (!editor.removed) {
const rng = editor.selection.getRng();
if (rng.collapsed) { // see TINY-1479
const caretRange = CefUtils.renderRangeCaret(editor, editor.selection.getRng(), false);
editor.selection.setRng(caretRange);
}
}
}, 0);
editor.on('focus', function () {
renderFocusCaret.throttle();
});
editor.on('blur', function () {
renderFocusCaret.cancel();
});
};
示例4: function
const sketch = function (onView, translate): SketchSpec {
const memIcon = Memento.record(
Container.sketch({
dom: UiDomFactory.dom('<div aria-hidden="true" class="${prefix}-mask-tap-icon"></div>'),
containerBehaviours: Behaviour.derive([
Toggling.config({
toggleClass: Styles.resolve('mask-tap-icon-selected'),
toggleOnExecute: false
})
])
})
);
const onViewThrottle = Throttler.first(onView, 200);
return Container.sketch({
dom: UiDomFactory.dom('<div class="${prefix}-disabled-mask"></div>'),
components: [
Container.sketch({
dom: UiDomFactory.dom('<div class="${prefix}-content-container"></div>'),
components: [
Button.sketch({
dom: UiDomFactory.dom('<div class="${prefix}-content-tap-section"></div>'),
components: [
memIcon.asSpec()
],
action (button) {
onViewThrottle.throttle();
},
buttonBehaviours: Behaviour.derive([
Toggling.config({
toggleClass: Styles.resolve('mask-tap-icon-selected')
})
])
})
]
})
]
});
};
示例5: normalizeNbspsInEditor
const setupIeInput = (editor: Editor) => {
// We need to delay this since the normalization should happen after typing a letter
// for example typing a<space>b in a paragraph would otherwise result in a a b
const keypressThrotter = Throttler.first(() => {
// We only care about non composing inputs since moving the caret or modifying the text node will blow away the IME
if (!editor.composing) {
normalizeNbspsInEditor(editor);
}
}, 0);
if (browser.isIE()) {
// IE doesn't have the input event so we need to fake that with a keypress on IE keypress is only fired on alpha numeric keys
editor.on('keypress', (e) => {
keypressThrotter.throttle();
});
editor.on('remove', (e) => {
keypressThrotter.cancel();
});
}
};
示例6: function
const setup = function (editor: Editor) {
const renderFocusCaret = Throttler.first(function () {
// AP-24 Added the second condition in this if because of a race condition with setting focus on the PowerPaste
// remove/keep formatting dialog on paste in IE11. Without this, because we paste twice on IE11, focus ends up set
// in the editor, not the dialog buttons. Specifically, we focus, blur, focus, blur, focus then enter this throttled
// code before the next blur has been able to run. With this check, this function doesn't run at all in this case,
// so focus goes to the dialog's buttons correctly.
if (!editor.removed && editor.getBody().contains(document.activeElement)) {
const rng = editor.selection.getRng();
if (rng.collapsed) { // see TINY-1479
const caretRange = CefUtils.renderRangeCaret(editor, editor.selection.getRng(), false);
editor.selection.setRng(caretRange);
}
}
}, 0);
editor.on('focus', function () {
renderFocusCaret.throttle();
});
editor.on('blur', function () {
renderFocusCaret.cancel();
});
};