本文整理匯總了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));
};