Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1347)

Unified Diff: sdk/lib/_internal/compiler/js_lib/preambles/d8.js

Issue 956953002: Support for a dart2js `dartDeferredLoader` hook. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix text in pkg/compiler/lib/src/js_emitter/old_emitter/declarations.dart Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/js_lib/preambles/d8.js
diff --git a/sdk/lib/_internal/compiler/js_lib/preambles/d8.js b/sdk/lib/_internal/compiler/js_lib/preambles/d8.js
index aed01611236ecf870687224cf08f78c8f0dc32fb..a48f918cf704bde5d69786c81e3453b10fdffad2 100644
--- a/sdk/lib/_internal/compiler/js_lib/preambles/d8.js
+++ b/sdk/lib/_internal/compiler/js_lib/preambles/d8.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -269,6 +269,7 @@ if (typeof global != "undefined") self = global; // Node.js.
// Global properties. "self" refers to the global object, so adding a
// property to "self" defines a global variable.
+ self.self = self
self.dartMainRunner = function(main, args) {
// Initialize.
var action = function() { main(args); }
@@ -279,5 +280,14 @@ if (typeof global != "undefined") self = global; // Node.js.
self.setInterval = addInterval;
self.clearInterval = cancelTimer;
self.scheduleImmediate = addTask;
- self.self = self;
+
+ // Support for deferred loading.
+ self.dartDeferredLibraryLoader = function(uri, successCallback, errorCallback) {
+ try {
+ load(uri);
+ successCallback();
+ } catch (error) {
+ errorCallback(error);
+ }
+ };
})(self);

Powered by Google App Engine
This is Rietveld 408576698