本文整理汇总了TypeScript中@angular/core.NgZone.runGuarded方法的典型用法代码示例。如果您正苦于以下问题:TypeScript NgZone.runGuarded方法的具体用法?TypeScript NgZone.runGuarded怎么用?TypeScript NgZone.runGuarded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/core.NgZone
的用法示例。
在下文中一共展示了NgZone.runGuarded方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: macroTask
macroTask(() => {
const exception = new Error('sync');
_zone.runGuarded(() => { throw exception; });
expect(_errors.length).toBe(1);
expect(_errors[0]).toBe(exception);
async.done();
});
示例2: return
return (event) => {
if (StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) {
zone.runGuarded(() => handler(event));
}
};
示例3: initRouter
function initRouter(platformLocation: WebWorkerPlatformLocation, zone: NgZone): Promise<boolean> {
return zone.runGuarded(() => { return platformLocation.init(); });
}
示例4: return
return () => {
return zone.runGuarded(() => platformLocation.init());
};
示例5: return
return (event: any /** TODO #9100 */) => {
if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {
zone.runGuarded(() => handler(event));
}
};
示例6: handler
let outsideHandler: any = (event: any) => {
zone.runGuarded(() => handler(event));
};