当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Throttler.first方法代码示例

本文整理汇总了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();
  });
};
开发者ID:howardjing,项目名称:tinymce,代码行数:16,代码来源:CefFocus.ts

示例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();
  });
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:17,代码来源:SelectionRestore.ts

示例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();
  });
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:19,代码来源:CefFocus.ts

示例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')
              })
            ])
          })
        ]
      })
    ]
  });
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:42,代码来源:TapToEditMask.ts

示例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&nbsp;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();
    });
  }
};
开发者ID:tinymce,项目名称:tinymce,代码行数:21,代码来源:InputKeys.ts

示例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();
  });
};
开发者ID:tinymce,项目名称:tinymce,代码行数:24,代码来源:CefFocus.ts


注:本文中的@ephox/katamari.Throttler.first方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。