本文整理匯總了TypeScript中@angular/core/src/zone/ng_zone.NgZone類的典型用法代碼示例。如果您正苦於以下問題:TypeScript NgZone類的具體用法?TypeScript NgZone怎麽用?TypeScript NgZone使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了NgZone類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: runNgZoneNoLog
runNgZoneNoLog(() => { expect(NgZone.isInAngularZone()).toEqual(true); });
示例2: it
it('should return whether the code executes in the inner zone', () => {
expect(NgZone.isInAngularZone()).toEqual(false);
runNgZoneNoLog(() => { expect(NgZone.isInAngularZone()).toEqual(true); });
}, testTimeout);
示例3:
next: () => {
NgZone.assertNotInAngularZone();
_log.add('onMyTaskDone');
}
示例4: macroTask
macroTask(() => { expect(_zone.run(() => { return 6; })).toEqual(6); });
示例5: macroTask
macroTask(() => { _zone.run(() => { scheduleMicroTask(() => { throw exception; }); }); });
示例6: expect
expect(() => _zone.run(() => { throw exception; })).toThrowError('sync');
示例7:
ObservableWrapper.subscribe(_zone.onMicrotaskEmpty, (_) => {
_log.add('onMicrotaskEmpty:started');
_zone.run(() => _log.add('nested run'));
_log.add('onMicrotaskEmpty:finished');
});