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


TypeScript Delay.setInterval函数代码示例

本文整理汇总了TypeScript中tinymce/core/api/util/Delay.setInterval函数的典型用法代码示例。如果您正苦于以下问题:TypeScript setInterval函数的具体用法?TypeScript setInterval怎么用?TypeScript setInterval使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setInterval函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

  const animate = function (getCurrent, destination, amount, increment, doFinish, rate) {
    let finished = false;

    const finish = function (v) {
      finished = true;
      doFinish(v);
    };

    Delay.clearInterval(interval);

    const abort = function (v) {
      Delay.clearInterval(interval);
      finish(v);
    };

    interval = Delay.setInterval(function () {
      const value = getCurrent();
      adjust(value, destination, amount).fold(function () {
        Delay.clearInterval(interval);
        finish(destination);
      }, function (s) {
        increment(s, abort);
        if (! finished) {
          const newValue = getCurrent();
          // Jump to the end if the increment is no longer working.
          if (newValue !== s || Math.abs(newValue - destination) > Math.abs(value - destination)) {
            Delay.clearInterval(interval);
            finish(destination);
          }
        }
      });
    }, rate);
  };
开发者ID:tinymce,项目名称:tinymce,代码行数:33,代码来源:SmoothAnimation.ts

示例2: function

  suite.test('clearTimeout', function () {
    let id;

    id = Delay.setInterval(function () {
      throw new Error('clearInterval didn\'t work.');
    });

    Delay.clearInterval(id);
    ok(true, 'clearInterval works.');
  });
开发者ID:abstask,项目名称:tinymce,代码行数:10,代码来源:DelayTest.ts

示例3: storeDraft

const startStoreDraft = (editor: Editor, started: Cell<boolean>) => {
  const interval = Settings.getAutoSaveInterval(editor);

  if (!started.get()) {
    Delay.setInterval(() => {
      if (!editor.removed) {
        storeDraft(editor);
      }
    }, interval);

    started.set(true);
  }
};
开发者ID:tinymce,项目名称:tinymce,代码行数:13,代码来源:Storage.ts

示例4: function

const onOrientationReady = function (outerWindow, refreshView) {
  // When rotating into portrait, the page (and toolbar) is off the top of the screen (pageYOffset > 0)
  // when the view settles, the toolbar will readjust to be visible/fixed to the top (pageYOffset = 0)
  // wait for the toolbar to recover before refreshing the view and scrolling cursor into view
  // done here instead of nomad toolbar fixup since that is tied to window scroll, which does not
  // fire on landscape
  const scrollNotZero = Delay.setInterval(function () {
    if (outerWindow.pageYOffset === 0) {
      Delay.clearInterval(scrollNotZero);
      refreshView();
    }
  }, 100);
};
开发者ID:tinymce,项目名称:tinymce,代码行数:13,代码来源:IosHacks.ts

示例5: Promise

 init: (e) => new Promise((resolve) => {
   const intervalId = Delay.setInterval(() => {
     if (resolveInit.get()) {
       Delay.clearInterval(intervalId);
       Class.add(Element.fromDom(e), 'my-custom-editor');
       resolve({
         setValue(s) { customEditorValue.set(s); },
         getValue() { return customEditorValue.get(); },
         destroy() {}
       });
     }
   }, 500);
 })
开发者ID:tinymce,项目名称:tinymce,代码行数:13,代码来源:BasicCustomEditorTest.ts

示例6: Promise

 return new Promise((resolve, reject) => {
   let numRetries = 3;
   const interval = Delay.setInterval(() => {
     if (hasLoaded()) {
       Delay.clearInterval(interval);
       resolve(true);
     } else {
       numRetries--;
       if (numRetries < 0) {
         console.log('Could not load emojis from url: ' + databaseUrl);
         Delay.clearInterval(interval);
         reject(false);
       }
     }
   }, 500);
 });
开发者ID:tinymce,项目名称:tinymce,代码行数:16,代码来源:EmojiDatabase.ts

示例7: function

  const onAdjustment = function (f) {
    // If a developer is spamming orientation events in the simulator, clear our last check
    Delay.clearInterval(poller);

    const flag = outerWindow.innerHeight;
    let insurance = 0;
    poller = Delay.setInterval(function () {
      if (flag !== outerWindow.innerHeight) {
        Delay.clearInterval(poller);
        f(Option.some(outerWindow.innerHeight));
      } else if (insurance > INSURANCE) {
        Delay.clearInterval(poller);
        f(Option.none());
      }
      insurance++;
    }, INTERVAL);
  };
开发者ID:tinymce,项目名称:tinymce,代码行数:17,代码来源:Orientation.ts

示例8: handleWindowResize

function handleWindowResize() {
  if (!Env.desktop) {
    let lastSize = {
      w: window.innerWidth,
      h: window.innerHeight
    };

    Delay.setInterval(function () {
      const w = window.innerWidth,
        h = window.innerHeight;

      if (lastSize.w !== w || lastSize.h !== h) {
        lastSize = {
          w,
          h
        };

        DomQuery(window).trigger('resize');
      }
    }, 100);
  }

  function reposition() {
    let i;
    const rect = DomUtils.getWindowSize();
    let layoutRect;

    for (i = 0; i < windows.length; i++) {
      layoutRect = windows[i].layoutRect();

      windows[i].moveTo(
        windows[i].settings.x || Math.max(0, rect.w / 2 - layoutRect.w / 2),
        windows[i].settings.y || Math.max(0, rect.h / 2 - layoutRect.h / 2)
      );
    }
  }

  DomQuery(window).on('resize', reposition);
}
开发者ID:danielpunkass,项目名称:tinymce,代码行数:39,代码来源:Window.ts


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