本文整理汇总了TypeScript中@angular/platform-browser-dynamic.bootstrapWorkerApp函数的典型用法代码示例。如果您正苦于以下问题:TypeScript bootstrapWorkerApp函数的具体用法?TypeScript bootstrapWorkerApp怎么用?TypeScript bootstrapWorkerApp使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bootstrapWorkerApp函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: main
export function main() {
bootstrapWorkerApp(App, [
ROUTER_PROVIDERS,
WORKER_APP_LOCATION_PROVIDERS,
{provide: LocationStrategy, useClass: HashLocationStrategy}
]);
}
示例2: main
export function main() {
bootstrapWorkerApp(HelloCmp);
}
示例3: constructor
selector: 'app',
template:'<div>Web worker loaded</div>'
})
class Worker {
time: string;
constructor(private _serviceBrokerFactory: ServiceMessageBrokerFactory){
var broker = _serviceBrokerFactory.createMessageBroker(FACTORIAL_CHANNEL, false);
broker.registerMethod("factorial", [PRIMITIVE], this.calculate, PRIMITIVE);
}
private calculate(val: string) {
if(val) {
let result = factorial(parseInt(val));
return Promise.resolve(result);
}
return Promise.resolve('');
}
}
bootstrapWorkerApp(Worker).catch(err => console.error(err));
function factorial(num) {
if (num === 0) {
return 1;
}
else {
return (num * factorial(num - 1));
}
}