當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript NgZone.run方法代碼示例

本文整理匯總了TypeScript中@angular/core/src/zone/ng_zone.NgZone.run方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript NgZone.run方法的具體用法?TypeScript NgZone.run怎麽用?TypeScript NgZone.run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@angular/core/src/zone/ng_zone.NgZone的用法示例。


在下文中一共展示了NgZone.run方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: macroTask

 macroTask(() => {
   _log.add('start run');
   _zone.run(() => {
     _log.add('nested run');
     scheduleMicroTask(_log.fn('nested run microtask'));
   });
   _log.add('end run');
 });
開發者ID:AngularLovers,項目名稱:angular,代碼行數:8,代碼來源:ng_zone_spec.ts

示例2: it

 it('should async even if the NgZone was created outside.', async(() => {
      // try to escape the current async zone by using NgZone which was created outside.
      ngZone.run(() => {
        setTimeout(() => {
          Promise.resolve('works').then((v) => asyncResult = v);
        }, waitLongerThenTestFrameworkAsyncTimeout);
      });
    }));
開發者ID:DanielKucal,項目名稱:angular,代碼行數:8,代碼來源:ng_zone_spec.ts

示例3: scheduleMicroTask

 next: () => {
   _log.add('onMicrotaskEmpty(begin)');
   if (!donePromiseRan) {
     _log.add('onMicrotaskEmpty(schedulePromise)');
     _zone.run(() => { scheduleMicroTask(_log.fn('onMicrotaskEmpty(executePromise)')); });
     donePromiseRan = true;
   }
   _log.add('onMicrotaskEmpty(end)');
 }
開發者ID:DanielKucal,項目名稱:angular,代碼行數:9,代碼來源:ng_zone_spec.ts

示例4: runNgZoneNoLog

function runNgZoneNoLog(fn: () => any) {
  var length = _log.logItems.length;
  try {
    return _zone.run(fn);
  } finally {
    // delete anything which may have gotten logged.
    _log.logItems.length = length;
  }
}
開發者ID:AngularLovers,項目名稱:angular,代碼行數:9,代碼來源:ng_zone_spec.ts

示例5: scheduleMicroTask

 ObservableWrapper.subscribe(_zone.onUnstable, (_) => {
   _log.add('onUnstable(begin)');
   if (!startPromiseRan) {
     _log.add('onUnstable(schedulePromise)');
     _zone.run(() => { scheduleMicroTask(_log.fn('onUnstable(executePromise)')); });
     startPromiseRan = true;
   }
   _log.add('onUnstable(end)');
 });
開發者ID:AngularLovers,項目名稱:angular,代碼行數:9,代碼來源:ng_zone_spec.ts


注:本文中的@angular/core/src/zone/ng_zone.NgZone.run方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。