| Index: sdk/lib/_internal/compiler/js_lib/js_helper.dart
|
| diff --git a/sdk/lib/_internal/compiler/js_lib/js_helper.dart b/sdk/lib/_internal/compiler/js_lib/js_helper.dart
|
| index e56c3c839211457c7cbe2cf3ffe66fd962ab177a..9f90fa817d8165391dda4f4df3aa247a798d109f 100644
|
| --- a/sdk/lib/_internal/compiler/js_lib/js_helper.dart
|
| +++ b/sdk/lib/_internal/compiler/js_lib/js_helper.dart
|
| @@ -3257,6 +3257,11 @@ LoadLibraryFunctionType _loadLibraryWrapper(String loadId) {
|
| final Map<String, Future<Null>> _loadingLibraries = <String, Future<Null>>{};
|
| final Set<String> _loadedLibraries = new Set<String>();
|
|
|
| +typedef void DeferredLoadCallback();
|
| +
|
| +// Function that will be called every time a new deferred import is loaded.
|
| +DeferredLoadCallback deferredLoadHook;
|
| +
|
| Future<Null> loadDeferredLibrary(String loadId) {
|
| // For each loadId there is a list of hunk-uris to load, and a corresponding
|
| // list of hashes. These are stored in the app-global scope.
|
| @@ -3277,7 +3282,10 @@ Future<Null> loadDeferredLibrary(String loadId) {
|
| // TODO(floitsch): Replace unsafe access to embedded global.
|
| JS('void', 'init.initializeLoadedHunk(#)', hash);
|
| }
|
| - _loadedLibraries.add(loadId);
|
| + bool updated = _loadedLibraries.add(loadId);
|
| + if (updated && deferredLoadHook != null) {
|
| + deferredLoadHook();
|
| + }
|
| });
|
| }
|
|
|
|
|