本文整理汇总了TypeScript中angular2/src/core/zone/vm_turn_zone.VmTurnZone类的典型用法代码示例。如果您正苦于以下问题:TypeScript VmTurnZone类的具体用法?TypeScript VmTurnZone怎么用?TypeScript VmTurnZone使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VmTurnZone类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: beforeEach
beforeEach(() => {
log = new Log();
zone = new VmTurnZone({enableLongStackTrace: true});
zone.initCallbacks({
onTurnStart: log.fn('onTurnStart'),
onTurnDone: log.fn('onTurnDone')
});
});
示例2: _createVmZone
function _createVmZone(givenReporter) {
var defaultErrorReporter = (exception, stackTrace) => {
var longStackTrace = ListWrapper.join(stackTrace, "\n\n-----async gap-----\n");
print(`${exception}\n\n${longStackTrace}`);
throw exception;
};
var reporter = isPresent(givenReporter) ? givenReporter : defaultErrorReporter;
var zone = new VmTurnZone({enableLongStackTrace: assertionsEnabled()});
zone.initCallbacks({onErrorHandler: reporter});
return zone;
}
示例3: it
it('should disable long stack traces', inject([AsyncTestCompleter], (async) => {
var zone = new VmTurnZone({enableLongStackTrace: false});
zone.initCallbacks({onErrorHandler: saveStackTrace});
var c = PromiseWrapper.completer();
zone.run(function() {
PromiseWrapper.setTimeout(function() {
PromiseWrapper.setTimeout(function() {
c.resolve(null);
throw new BaseException('ccc');
}, 0);
}, 0);
});
c.promise.then((_) => {
expect(trace.length).toEqual(1);
async.done();
});
}));