OLD | NEW |
1 dart_library.library('async_helper', null, /* Imports */[ | 1 dart_library.library('async_helper', null, /* Imports */[ |
2 'dart_sdk' | 2 'dart_sdk' |
3 ], function(exports, dart_sdk) { | 3 ], function(exports, dart_sdk) { |
4 'use strict'; | 4 'use strict'; |
5 const core = dart_sdk.core; | 5 const core = dart_sdk.core; |
6 const dart = dart_sdk.dart; | 6 const dart = dart_sdk.dart; |
7 const dartx = dart_sdk.dartx; | 7 const dartx = dart_sdk.dartx; |
8 const async_helper = Object.create(null); | 8 const async_helper = Object.create(null); |
9 async_helper._initialized = false; | 9 async_helper._initialized = false; |
10 async_helper._Action0 = dart.typedef('_Action0', () => dart.functionType(dart.
void, [])); | 10 async_helper._Action0 = dart.typedef('_Action0', () => dart.functionType(dart.
void, [])); |
11 async_helper._onAsyncEnd = null; | 11 async_helper._onAsyncEnd = null; |
12 async_helper._asyncLevel = 0; | 12 async_helper._asyncLevel = 0; |
13 async_helper._buildException = function(msg) { | 13 async_helper._buildException = function(msg) { |
14 return core.Exception.new(`Fatal: ${msg}. This is most likely a bug in your
test.`); | 14 return core.Exception.new(dart.str`Fatal: ${msg}. This is most likely a bug
in your test.`); |
15 }; | 15 }; |
16 dart.fn(async_helper._buildException, core.Exception, [core.String]); | 16 dart.fn(async_helper._buildException, core.Exception, [core.String]); |
17 async_helper.asyncTestInitialize = function(callback) { | 17 async_helper.asyncTestInitialize = function(callback) { |
18 async_helper._asyncLevel = 0; | 18 async_helper._asyncLevel = 0; |
19 async_helper._initialized = false; | 19 async_helper._initialized = false; |
20 async_helper._onAsyncEnd = callback; | 20 async_helper._onAsyncEnd = callback; |
21 }; | 21 }; |
22 dart.fn(async_helper.asyncTestInitialize, dart.void, [async_helper._Action0]); | 22 dart.fn(async_helper.asyncTestInitialize, dart.void, [async_helper._Action0]); |
23 dart.copyProperties(async_helper, { | 23 dart.copyProperties(async_helper, { |
24 get asyncTestStarted() { | 24 get asyncTestStarted() { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 }; | 61 }; |
62 dart.fn(async_helper.asyncSuccess, dart.void, [dart.dynamic]); | 62 dart.fn(async_helper.asyncSuccess, dart.void, [dart.dynamic]); |
63 async_helper.asyncTest = function(f) { | 63 async_helper.asyncTest = function(f) { |
64 async_helper.asyncStart(); | 64 async_helper.asyncStart(); |
65 dart.dsend(f(), 'then', async_helper.asyncSuccess); | 65 dart.dsend(f(), 'then', async_helper.asyncSuccess); |
66 }; | 66 }; |
67 dart.fn(async_helper.asyncTest, dart.void, [dart.functionType(dart.dynamic, []
)]); | 67 dart.fn(async_helper.asyncTest, dart.void, [dart.functionType(dart.dynamic, []
)]); |
68 // Exports: | 68 // Exports: |
69 exports.async_helper = async_helper; | 69 exports.async_helper = async_helper; |
70 }); | 70 }); |
OLD | NEW |