本文整理汇总了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');
});