ember-source 4.4.0-alpha.7 → 4.5.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +2 -2
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +1 -1
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +737 -867
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/container/index.js +3 -10
- package/dist/packages/@ember/-internals/glimmer/index.js +19 -7
- package/dist/packages/@ember/-internals/owner/index.js +3 -0
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +3 -0
- package/dist/packages/@ember/-internals/runtime/lib/system/namespace.js +15 -9
- package/dist/packages/@ember/-internals/views/lib/views/core_view.js +4 -6
- package/dist/packages/@ember/application/instance.js +93 -171
- package/dist/packages/@ember/application/lib/application.js +201 -304
- package/dist/packages/@ember/application/lib/lazy_load.js +8 -7
- package/dist/packages/@ember/engine/index.js +313 -275
- package/dist/packages/@ember/engine/instance.js +74 -72
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +350 -406
- package/package.json +2 -2
package/dist/ember.debug.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
|
|
7
7
|
* @license Licensed under MIT license
|
|
8
8
|
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
|
|
9
|
-
* @version 4.
|
|
9
|
+
* @version 4.5.0-alpha.2
|
|
10
10
|
*/
|
|
11
11
|
/* eslint-disable no-var */
|
|
12
12
|
|
|
@@ -264,8 +264,7 @@ define("@ember/-internals/container/index", ["exports", "@ember/-internals/owner
|
|
|
264
264
|
@private
|
|
265
265
|
@method lookup
|
|
266
266
|
@param {String} fullName
|
|
267
|
-
@param {
|
|
268
|
-
@param {String} [options.source] The fullname of the request source (used for local lookup)
|
|
267
|
+
@param {TypeOptions} [options]
|
|
269
268
|
@return {any}
|
|
270
269
|
*/
|
|
271
270
|
|
|
@@ -345,9 +344,7 @@ define("@ember/-internals/container/index", ["exports", "@ember/-internals/owner
|
|
|
345
344
|
}
|
|
346
345
|
|
|
347
346
|
var normalizedName = this.registry.normalize(fullName);
|
|
348
|
-
(true && !(this.registry.isValidFullName(normalizedName)) && (0, _debug.assert)('fullName must be a proper full name', this.registry.isValidFullName(normalizedName)));
|
|
349
|
-
// We should correctly the types so that this cast is not necessary.
|
|
350
|
-
|
|
347
|
+
(true && !(this.registry.isValidFullName(normalizedName)) && (0, _debug.assert)('fullName must be a proper full name', this.registry.isValidFullName(normalizedName)));
|
|
351
348
|
return factoryFor(this, normalizedName, fullName);
|
|
352
349
|
}
|
|
353
350
|
|
|
@@ -632,7 +629,6 @@ define("@ember/-internals/container/index", ["exports", "@ember/-internals/owner
|
|
|
632
629
|
this.fallback = options.fallback || null;
|
|
633
630
|
this.resolver = options.resolver || null;
|
|
634
631
|
this.registrations = (0, _utils.dictionary)(options.registrations || null);
|
|
635
|
-
this._localLookupCache = Object.create(null);
|
|
636
632
|
this._normalizeCache = (0, _utils.dictionary)(null);
|
|
637
633
|
this._resolveCache = (0, _utils.dictionary)(null);
|
|
638
634
|
this._failSet = new Set();
|
|
@@ -729,7 +725,6 @@ define("@ember/-internals/container/index", ["exports", "@ember/-internals/owner
|
|
|
729
725
|
unregister(fullName) {
|
|
730
726
|
(true && !(this.isValidFullName(fullName)) && (0, _debug.assert)('fullName must be a proper full name', this.isValidFullName(fullName)));
|
|
731
727
|
var normalizedName = this.normalize(fullName);
|
|
732
|
-
this._localLookupCache = Object.create(null);
|
|
733
728
|
delete this.registrations[normalizedName];
|
|
734
729
|
delete this._resolveCache[normalizedName];
|
|
735
730
|
delete this._options[normalizedName];
|
|
@@ -760,8 +755,6 @@ define("@ember/-internals/container/index", ["exports", "@ember/-internals/owner
|
|
|
760
755
|
@private
|
|
761
756
|
@method resolve
|
|
762
757
|
@param {String} fullName
|
|
763
|
-
@param {Object} [options]
|
|
764
|
-
@param {String} [options.source] the fullname of the request source (used for local lookups)
|
|
765
758
|
@return {Function} fullName's factory
|
|
766
759
|
*/
|
|
767
760
|
|
|
@@ -770,7 +763,7 @@ define("@ember/-internals/container/index", ["exports", "@ember/-internals/owner
|
|
|
770
763
|
var factory = resolve(this, this.normalize(fullName));
|
|
771
764
|
|
|
772
765
|
if (factory === undefined && this.fallback !== null) {
|
|
773
|
-
factory = this.fallback.resolve(
|
|
766
|
+
factory = this.fallback.resolve(fullName);
|
|
774
767
|
}
|
|
775
768
|
|
|
776
769
|
return factory;
|
|
@@ -4947,6 +4940,7 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
4947
4940
|
init(properties) {
|
|
4948
4941
|
super.init(properties);
|
|
4949
4942
|
this[RECOMPUTE_TAG] = (0, _validator.createTag)();
|
|
4943
|
+
(true && !(this.compute) && (0, _debug.assert)('expected compute to be defined', this.compute));
|
|
4950
4944
|
}
|
|
4951
4945
|
/**
|
|
4952
4946
|
On a class-based helper, it may be useful to force a recomputation of that
|
|
@@ -5001,6 +4995,21 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
5001
4995
|
|
|
5002
4996
|
createHelper(definition, args) {
|
|
5003
4997
|
var instance = isFactoryManager(definition) ? definition.create() : definition.create(this.ownerInjection);
|
|
4998
|
+
(true && !(function (instance) {
|
|
4999
|
+
if (instance !== null && typeof instance === 'object') {
|
|
5000
|
+
var cast = instance;
|
|
5001
|
+
return typeof cast.compute === 'function' && typeof cast.destroy === 'function';
|
|
5002
|
+
}
|
|
5003
|
+
|
|
5004
|
+
return false;
|
|
5005
|
+
}(instance)) && (0, _debug.assert)('expected HelperInstance', function (instance) {
|
|
5006
|
+
if (instance !== null && typeof instance === 'object') {
|
|
5007
|
+
var cast = instance;
|
|
5008
|
+
return typeof cast.compute === 'function' && typeof cast.destroy === 'function';
|
|
5009
|
+
}
|
|
5010
|
+
|
|
5011
|
+
return false;
|
|
5012
|
+
}(instance)));
|
|
5004
5013
|
return {
|
|
5005
5014
|
instance,
|
|
5006
5015
|
args
|
|
@@ -5265,9 +5274,12 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
5265
5274
|
(true && !(currentOwner instanceof _instance.default) && (0, _debug.assert)('Expected currentOwner to be an EngineInstance', currentOwner instanceof _instance.default));
|
|
5266
5275
|
var mountPoint = currentOwner.mountPoint;
|
|
5267
5276
|
state.engine = currentOwner;
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5277
|
+
|
|
5278
|
+
if (mountPoint) {
|
|
5279
|
+
state.engineBucket = {
|
|
5280
|
+
mountPoint
|
|
5281
|
+
};
|
|
5282
|
+
}
|
|
5271
5283
|
}
|
|
5272
5284
|
}
|
|
5273
5285
|
|
|
@@ -7074,7 +7086,7 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
7074
7086
|
function lookupComponentPair(owner, name, options) {
|
|
7075
7087
|
var component = componentFor(name, owner);
|
|
7076
7088
|
|
|
7077
|
-
if (component
|
|
7089
|
+
if ((0, _owner2.isFactory)(component) && component.class) {
|
|
7078
7090
|
var _layout = (0, _manager2.getComponentTemplate)(component.class);
|
|
7079
7091
|
|
|
7080
7092
|
if (_layout !== undefined) {
|
|
@@ -12713,8 +12725,12 @@ define("@ember/-internals/owner/index", ["exports", "@glimmer/owner"], function
|
|
|
12713
12725
|
value: true
|
|
12714
12726
|
});
|
|
12715
12727
|
_exports.getOwner = getOwner;
|
|
12728
|
+
_exports.isFactory = isFactory;
|
|
12716
12729
|
_exports.setOwner = setOwner;
|
|
12717
12730
|
|
|
12731
|
+
function isFactory(obj) {
|
|
12732
|
+
return obj != null && typeof obj.create === 'function';
|
|
12733
|
+
}
|
|
12718
12734
|
/**
|
|
12719
12735
|
Framework objects in an Ember application (components, services, routes, etc.)
|
|
12720
12736
|
are created via a factory and dependency injection system. Each of these
|
|
@@ -12759,6 +12775,8 @@ define("@ember/-internals/owner/index", ["exports", "@glimmer/owner"], function
|
|
|
12759
12775
|
@since 2.3.0
|
|
12760
12776
|
@public
|
|
12761
12777
|
*/
|
|
12778
|
+
|
|
12779
|
+
|
|
12762
12780
|
function getOwner(object) {
|
|
12763
12781
|
return (0, _owner.getOwner)(object);
|
|
12764
12782
|
}
|
|
@@ -17091,6 +17109,8 @@ define("@ember/-internals/routing/lib/system/router", ["exports", "@ember/-inter
|
|
|
17091
17109
|
*/
|
|
17092
17110
|
|
|
17093
17111
|
class EmberRouter extends _runtime.Object.extend(_runtime.Evented) {
|
|
17112
|
+
// Note that owner is actually required in this scenario, but since it is strictly
|
|
17113
|
+
// optional in other contexts trying to make it required here confuses TS.
|
|
17094
17114
|
constructor(owner) {
|
|
17095
17115
|
super(owner);
|
|
17096
17116
|
this._didSetupRouter = false;
|
|
@@ -17110,6 +17130,7 @@ define("@ember/-internals/routing/lib/system/router", ["exports", "@ember/-inter
|
|
|
17110
17130
|
this._slowTransitionTimer = null;
|
|
17111
17131
|
this.currentState = null;
|
|
17112
17132
|
this.targetState = null;
|
|
17133
|
+
(true && !(owner) && (0, _debug.assert)('BUG: Missing owner', owner));
|
|
17113
17134
|
|
|
17114
17135
|
this._resetQueuedQueryParameterChanges();
|
|
17115
17136
|
|
|
@@ -24245,7 +24266,7 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
24245
24266
|
var _default = CoreObject;
|
|
24246
24267
|
_exports.default = _default;
|
|
24247
24268
|
});
|
|
24248
|
-
define("@ember/-internals/runtime/lib/system/namespace", ["exports", "@ember/-internals/metal", "@ember/-internals/utils", "@ember/-internals/runtime/lib/system/object"], function (_exports, _metal, _utils, _object) {
|
|
24269
|
+
define("@ember/-internals/runtime/lib/system/namespace", ["exports", "@ember/-internals/metal", "@ember/-internals/utils", "@ember/debug", "@ember/-internals/runtime/lib/system/object"], function (_exports, _metal, _utils, _debug, _object) {
|
|
24249
24270
|
"use strict";
|
|
24250
24271
|
|
|
24251
24272
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -24276,19 +24297,21 @@ define("@ember/-internals/runtime/lib/system/namespace", ["exports", "@ember/-in
|
|
|
24276
24297
|
@public
|
|
24277
24298
|
*/
|
|
24278
24299
|
class Namespace extends _object.default {
|
|
24279
|
-
init() {
|
|
24300
|
+
init(properties) {
|
|
24301
|
+
super.init(properties);
|
|
24280
24302
|
(0, _metal.addNamespace)(this);
|
|
24281
24303
|
}
|
|
24282
24304
|
|
|
24283
24305
|
toString() {
|
|
24284
|
-
var
|
|
24306
|
+
var existing_name = (0, _metal.get)(this, 'name') || (0, _metal.get)(this, 'modulePrefix');
|
|
24285
24307
|
|
|
24286
|
-
if (
|
|
24287
|
-
|
|
24308
|
+
if (existing_name) {
|
|
24309
|
+
(true && !(typeof existing_name === 'string') && (0, _debug.assert)("name wasn't a string", typeof existing_name === 'string'));
|
|
24310
|
+
return existing_name;
|
|
24288
24311
|
}
|
|
24289
24312
|
|
|
24290
24313
|
(0, _metal.findNamespaces)();
|
|
24291
|
-
name = (0, _utils.getName)(this);
|
|
24314
|
+
var name = (0, _utils.getName)(this);
|
|
24292
24315
|
|
|
24293
24316
|
if (name === undefined) {
|
|
24294
24317
|
name = (0, _utils.guidFor)(this);
|
|
@@ -24304,17 +24327,19 @@ define("@ember/-internals/runtime/lib/system/namespace", ["exports", "@ember/-in
|
|
|
24304
24327
|
|
|
24305
24328
|
destroy() {
|
|
24306
24329
|
(0, _metal.removeNamespace)(this);
|
|
24307
|
-
super.destroy();
|
|
24330
|
+
return super.destroy();
|
|
24308
24331
|
}
|
|
24309
24332
|
|
|
24310
24333
|
}
|
|
24311
24334
|
|
|
24312
|
-
_exports.default = Namespace;
|
|
24313
|
-
Namespace.prototype.isNamespace = true;
|
|
24314
24335
|
Namespace.NAMESPACES = _metal.NAMESPACES;
|
|
24315
24336
|
Namespace.NAMESPACES_BY_ID = _metal.NAMESPACES_BY_ID;
|
|
24316
24337
|
Namespace.processAll = _metal.processAllNamespaces;
|
|
24317
|
-
Namespace.byName = _metal.findNamespace;
|
|
24338
|
+
Namespace.byName = _metal.findNamespace; // Declare on the prototype to have a single shared value.
|
|
24339
|
+
|
|
24340
|
+
Namespace.prototype.isNamespace = true;
|
|
24341
|
+
var _default = Namespace;
|
|
24342
|
+
_exports.default = _default;
|
|
24318
24343
|
});
|
|
24319
24344
|
define("@ember/-internals/runtime/lib/system/object", ["exports", "@ember/-internals/container", "@ember/-internals/utils", "@ember/-internals/metal", "@ember/-internals/runtime/lib/system/core_object", "@ember/-internals/runtime/lib/mixins/observable", "@ember/debug"], function (_exports, _container, _utils, _metal, _core_object, _observable, _debug) {
|
|
24320
24345
|
"use strict";
|
|
@@ -26884,11 +26909,7 @@ define("@ember/-internals/views/lib/views/core_view", ["exports", "@ember/-inter
|
|
|
26884
26909
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
26885
26910
|
};
|
|
26886
26911
|
|
|
26887
|
-
class CoreView extends _runtime.FrameworkObject.extend(_runtime.Evented, _runtime.ActionHandler
|
|
26888
|
-
// Continue to declare `_states` here so that we have a single reference on the prototype
|
|
26889
|
-
// instead of one on each instance.
|
|
26890
|
-
_states: _states.default
|
|
26891
|
-
}) {
|
|
26912
|
+
class CoreView extends _runtime.FrameworkObject.extend(_runtime.Evented, _runtime.ActionHandler) {
|
|
26892
26913
|
constructor() {
|
|
26893
26914
|
super(...arguments);
|
|
26894
26915
|
this.isView = true;
|
|
@@ -26950,8 +26971,10 @@ define("@ember/-internals/views/lib/views/core_view", ["exports", "@ember/-inter
|
|
|
26950
26971
|
|
|
26951
26972
|
CoreView.isViewFactory = true;
|
|
26952
26973
|
|
|
26953
|
-
__decorate([(0, _metal.inject)('renderer', '-dom')], CoreView.prototype, "renderer", void 0);
|
|
26974
|
+
__decorate([(0, _metal.inject)('renderer', '-dom')], CoreView.prototype, "renderer", void 0); // Declare on the prototype to have a single shared value.
|
|
26975
|
+
|
|
26954
26976
|
|
|
26977
|
+
CoreView.prototype._states = _states.default;
|
|
26955
26978
|
var _default = CoreView;
|
|
26956
26979
|
_exports.default = _default;
|
|
26957
26980
|
});
|
|
@@ -27173,7 +27196,7 @@ define("@ember/application/index", ["exports", "@ember/-internals/owner", "@embe
|
|
|
27173
27196
|
}
|
|
27174
27197
|
});
|
|
27175
27198
|
});
|
|
27176
|
-
define("@ember/application/instance", ["exports", "@ember/-internals/metal", "@ember/-internals/browser-environment", "@ember/engine/instance", "@ember/-internals/glimmer"], function (_exports, _metal, environment, _instance, _glimmer) {
|
|
27199
|
+
define("@ember/application/instance", ["exports", "@ember/-internals/metal", "@ember/-internals/browser-environment", "@ember/engine/instance", "@ember/-internals/glimmer", "@ember/debug", "@ember/-internals/routing", "@ember/-internals/views"], function (_exports, _metal, environment, _instance, _glimmer, _debug, _routing, _views) {
|
|
27177
27200
|
"use strict";
|
|
27178
27201
|
|
|
27179
27202
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -27209,35 +27232,21 @@ define("@ember/application/instance", ["exports", "@ember/-internals/metal", "@e
|
|
|
27209
27232
|
@class ApplicationInstance
|
|
27210
27233
|
@extends EngineInstance
|
|
27211
27234
|
*/
|
|
27212
|
-
|
|
27213
|
-
|
|
27214
|
-
|
|
27215
|
-
|
|
27216
|
-
|
|
27217
|
-
|
|
27218
|
-
|
|
27219
|
-
|
|
27220
|
-
|
|
27221
|
-
The DOM events for which the event dispatcher should listen.
|
|
27222
|
-
By default, the application's `Ember.EventDispatcher` listens
|
|
27223
|
-
for a set of standard DOM events, such as `mousedown` and
|
|
27224
|
-
`keyup`, and delegates them to your application's `Ember.View`
|
|
27225
|
-
instances.
|
|
27226
|
-
@private
|
|
27227
|
-
@property {Object} customEvents
|
|
27228
|
-
*/
|
|
27229
|
-
customEvents: null,
|
|
27235
|
+
class ApplicationInstance extends _instance.default {
|
|
27236
|
+
constructor() {
|
|
27237
|
+
super(...arguments);
|
|
27238
|
+
/**
|
|
27239
|
+
The root DOM element of the Application as an element or a
|
|
27240
|
+
CSS selector.
|
|
27241
|
+
@private
|
|
27242
|
+
@property {String|DOMElement} rootElement
|
|
27243
|
+
*/
|
|
27230
27244
|
|
|
27231
|
-
|
|
27232
|
-
|
|
27233
|
-
CSS selector.
|
|
27234
|
-
@private
|
|
27235
|
-
@property {String|DOMElement} rootElement
|
|
27236
|
-
*/
|
|
27237
|
-
rootElement: null,
|
|
27245
|
+
this.rootElement = null;
|
|
27246
|
+
}
|
|
27238
27247
|
|
|
27239
|
-
init() {
|
|
27240
|
-
|
|
27248
|
+
init(properties) {
|
|
27249
|
+
super.init(properties);
|
|
27241
27250
|
|
|
27242
27251
|
this.application._watchInstance(this); // Register this instance in the per-instance registry.
|
|
27243
27252
|
//
|
|
@@ -27251,25 +27260,26 @@ define("@ember/application/instance", ["exports", "@ember/-internals/metal", "@e
|
|
|
27251
27260
|
this.register('-application-instance:main', this, {
|
|
27252
27261
|
instantiate: false
|
|
27253
27262
|
});
|
|
27254
|
-
}
|
|
27255
|
-
|
|
27263
|
+
}
|
|
27256
27264
|
/**
|
|
27257
27265
|
Overrides the base `EngineInstance._bootSync` method with concerns relevant
|
|
27258
27266
|
to booting application (instead of engine) instances.
|
|
27259
|
-
|
|
27267
|
+
This method should only contain synchronous boot concerns. Asynchronous
|
|
27260
27268
|
boot concerns should eventually be moved to the `boot` method, which
|
|
27261
27269
|
returns a promise.
|
|
27262
|
-
|
|
27270
|
+
Until all boot code has been made asynchronous, we need to continue to
|
|
27263
27271
|
expose this method for use *internally* in places where we need to boot an
|
|
27264
27272
|
instance synchronously.
|
|
27265
|
-
|
|
27273
|
+
@private
|
|
27266
27274
|
*/
|
|
27275
|
+
|
|
27276
|
+
|
|
27267
27277
|
_bootSync(options) {
|
|
27268
27278
|
if (this._booted) {
|
|
27269
27279
|
return this;
|
|
27270
27280
|
}
|
|
27271
27281
|
|
|
27272
|
-
options = new
|
|
27282
|
+
options = new _BootOptions(options);
|
|
27273
27283
|
this.setupRegistry(options);
|
|
27274
27284
|
|
|
27275
27285
|
if (options.rootElement) {
|
|
@@ -27290,93 +27300,104 @@ define("@ember/application/instance", ["exports", "@ember/-internals/metal", "@e
|
|
|
27290
27300
|
|
|
27291
27301
|
this._booted = true;
|
|
27292
27302
|
return this;
|
|
27293
|
-
}
|
|
27303
|
+
}
|
|
27294
27304
|
|
|
27295
27305
|
setupRegistry(options) {
|
|
27296
27306
|
this.constructor.setupRegistry(this.__registry__, options);
|
|
27297
|
-
}
|
|
27307
|
+
}
|
|
27298
27308
|
|
|
27299
|
-
router
|
|
27300
|
-
|
|
27301
|
-
|
|
27309
|
+
get router() {
|
|
27310
|
+
if (!this._router) {
|
|
27311
|
+
var router = this.lookup('router:main');
|
|
27312
|
+
(true && !(router instanceof _routing.Router) && (0, _debug.assert)('expected an instance of Router', router instanceof _routing.Router));
|
|
27313
|
+
this._router = router;
|
|
27314
|
+
}
|
|
27302
27315
|
|
|
27316
|
+
return this._router;
|
|
27317
|
+
}
|
|
27303
27318
|
/**
|
|
27304
27319
|
This hook is called by the root-most Route (a.k.a. the ApplicationRoute)
|
|
27305
27320
|
when it has finished creating the root View. By default, we simply take the
|
|
27306
27321
|
view and append it to the `rootElement` specified on the Application.
|
|
27307
|
-
|
|
27322
|
+
In cases like FastBoot and testing, we can override this hook and implement
|
|
27308
27323
|
custom behavior, such as serializing to a string and sending over an HTTP
|
|
27309
27324
|
socket rather than appending to DOM.
|
|
27310
|
-
|
|
27325
|
+
@param view {Ember.View} the root-most view
|
|
27311
27326
|
@deprecated
|
|
27312
27327
|
@private
|
|
27313
27328
|
*/
|
|
27329
|
+
|
|
27330
|
+
|
|
27314
27331
|
didCreateRootView(view) {
|
|
27315
27332
|
view.appendTo(this.rootElement);
|
|
27316
|
-
}
|
|
27317
|
-
|
|
27333
|
+
}
|
|
27318
27334
|
/**
|
|
27319
27335
|
Tells the router to start routing. The router will ask the location for the
|
|
27320
27336
|
current URL of the page to determine the initial URL to start routing to.
|
|
27321
27337
|
To start the app at a specific URL, call `handleURL` instead.
|
|
27322
|
-
|
|
27338
|
+
@private
|
|
27323
27339
|
*/
|
|
27340
|
+
|
|
27341
|
+
|
|
27324
27342
|
startRouting() {
|
|
27325
27343
|
this.router.startRouting();
|
|
27326
|
-
}
|
|
27327
|
-
|
|
27344
|
+
}
|
|
27328
27345
|
/**
|
|
27329
27346
|
Sets up the router, initializing the child router and configuring the
|
|
27330
27347
|
location before routing begins.
|
|
27331
|
-
|
|
27348
|
+
Because setup should only occur once, multiple calls to `setupRouter`
|
|
27332
27349
|
beyond the first call have no effect.
|
|
27333
|
-
|
|
27350
|
+
This is commonly used in order to confirm things that rely on the router
|
|
27334
27351
|
are functioning properly from tests that are primarily rendering related.
|
|
27335
|
-
|
|
27352
|
+
For example, from within [ember-qunit](https://github.com/emberjs/ember-qunit)'s
|
|
27336
27353
|
`setupRenderingTest` calling `this.owner.setupRouter()` would allow that
|
|
27337
27354
|
rendering test to confirm that any `<LinkTo></LinkTo>`'s that are rendered
|
|
27338
27355
|
have the correct URL.
|
|
27339
|
-
|
|
27356
|
+
@public
|
|
27340
27357
|
*/
|
|
27358
|
+
|
|
27359
|
+
|
|
27341
27360
|
setupRouter() {
|
|
27342
27361
|
this.router.setupRouter();
|
|
27343
|
-
}
|
|
27344
|
-
|
|
27362
|
+
}
|
|
27345
27363
|
/**
|
|
27346
27364
|
Directs the router to route to a particular URL. This is useful in tests,
|
|
27347
27365
|
for example, to tell the app to start at a particular URL.
|
|
27348
|
-
|
|
27366
|
+
@param url {String} the URL the router should route to
|
|
27349
27367
|
@private
|
|
27350
27368
|
*/
|
|
27369
|
+
|
|
27370
|
+
|
|
27351
27371
|
handleURL(url) {
|
|
27352
27372
|
this.setupRouter();
|
|
27353
27373
|
return this.router.handleURL(url);
|
|
27354
|
-
}
|
|
27355
|
-
|
|
27374
|
+
}
|
|
27356
27375
|
/**
|
|
27357
27376
|
@private
|
|
27358
27377
|
*/
|
|
27378
|
+
|
|
27379
|
+
|
|
27359
27380
|
setupEventDispatcher() {
|
|
27360
27381
|
var dispatcher = this.lookup('event_dispatcher:main');
|
|
27382
|
+
(true && !(dispatcher instanceof _views.EventDispatcher) && (0, _debug.assert)('expected EventDispatcher', dispatcher instanceof _views.EventDispatcher));
|
|
27361
27383
|
var applicationCustomEvents = (0, _metal.get)(this.application, 'customEvents');
|
|
27362
27384
|
var instanceCustomEvents = (0, _metal.get)(this, 'customEvents');
|
|
27363
27385
|
var customEvents = Object.assign({}, applicationCustomEvents, instanceCustomEvents);
|
|
27364
27386
|
dispatcher.setup(customEvents, this.rootElement);
|
|
27365
27387
|
return dispatcher;
|
|
27366
|
-
}
|
|
27367
|
-
|
|
27388
|
+
}
|
|
27368
27389
|
/**
|
|
27369
27390
|
Returns the current URL of the app instance. This is useful when your
|
|
27370
27391
|
app does not update the browsers URL bar (i.e. it uses the `'none'`
|
|
27371
27392
|
location adapter).
|
|
27372
|
-
|
|
27393
|
+
@public
|
|
27373
27394
|
@return {String} the current URL
|
|
27374
27395
|
*/
|
|
27396
|
+
|
|
27397
|
+
|
|
27375
27398
|
getURL() {
|
|
27376
27399
|
return this.router.url;
|
|
27377
|
-
}
|
|
27378
|
-
|
|
27379
|
-
// `instance.visit(url)` should eventually replace `instance.handleURL()`;
|
|
27400
|
+
} // `instance.visit(url)` should eventually replace `instance.handleURL()`;
|
|
27380
27401
|
// the test helpers can probably be switched to use this implementation too
|
|
27381
27402
|
|
|
27382
27403
|
/**
|
|
@@ -27384,10 +27405,12 @@ define("@ember/application/instance", ["exports", "@ember/-internals/metal", "@e
|
|
|
27384
27405
|
example, or to tell the app to start at a particular URL. This method
|
|
27385
27406
|
returns a promise that resolves with the app instance when the transition
|
|
27386
27407
|
is complete, or rejects if the transion was aborted due to an error.
|
|
27387
|
-
|
|
27408
|
+
@public
|
|
27388
27409
|
@param url {String} the destination URL
|
|
27389
27410
|
@return {Promise<ApplicationInstance>}
|
|
27390
27411
|
*/
|
|
27412
|
+
|
|
27413
|
+
|
|
27391
27414
|
visit(url) {
|
|
27392
27415
|
this.setupRouter();
|
|
27393
27416
|
|
|
@@ -27417,48 +27440,43 @@ define("@ember/application/instance", ["exports", "@ember/-internals/metal", "@e
|
|
|
27417
27440
|
}
|
|
27418
27441
|
};
|
|
27419
27442
|
|
|
27420
|
-
var location = (0, _metal.get)(router, 'location');
|
|
27443
|
+
var location = (0, _metal.get)(router, 'location');
|
|
27444
|
+
(true && !(typeof location !== 'string') && (0, _debug.assert)('location has been initialized', typeof location !== 'string')); // Keeps the location adapter's internal URL in-sync
|
|
27421
27445
|
|
|
27422
27446
|
location.setURL(url); // getURL returns the set url with the rootURL stripped off
|
|
27423
27447
|
|
|
27424
27448
|
return router.handleURL(location.getURL()).then(handleTransitionResolve, handleTransitionReject);
|
|
27425
|
-
}
|
|
27449
|
+
}
|
|
27426
27450
|
|
|
27427
27451
|
willDestroy() {
|
|
27428
|
-
|
|
27452
|
+
super.willDestroy();
|
|
27429
27453
|
|
|
27430
27454
|
this.application._unwatchInstance(this);
|
|
27431
27455
|
}
|
|
27432
|
-
|
|
27433
|
-
});
|
|
27434
|
-
|
|
27435
|
-
ApplicationInstance.reopenClass({
|
|
27436
27456
|
/**
|
|
27437
27457
|
@private
|
|
27438
27458
|
@method setupRegistry
|
|
27439
27459
|
@param {Registry} registry
|
|
27440
27460
|
@param {BootOptions} options
|
|
27441
27461
|
*/
|
|
27442
|
-
|
|
27462
|
+
|
|
27463
|
+
|
|
27464
|
+
static setupRegistry(registry, options) {
|
|
27443
27465
|
if (options === void 0) {
|
|
27444
27466
|
options = {};
|
|
27445
27467
|
}
|
|
27446
27468
|
|
|
27447
|
-
|
|
27448
|
-
|
|
27449
|
-
}
|
|
27450
|
-
|
|
27451
|
-
registry.register('-environment:main', options.toEnvironment(), {
|
|
27469
|
+
var coptions = options instanceof _BootOptions ? options : new _BootOptions(options);
|
|
27470
|
+
registry.register('-environment:main', coptions.toEnvironment(), {
|
|
27452
27471
|
instantiate: false
|
|
27453
27472
|
});
|
|
27454
|
-
registry.register('service:-document',
|
|
27473
|
+
registry.register('service:-document', coptions.document, {
|
|
27455
27474
|
instantiate: false
|
|
27456
27475
|
});
|
|
27457
|
-
|
|
27458
|
-
this._super(registry, options);
|
|
27476
|
+
super.setupRegistry(registry, coptions);
|
|
27459
27477
|
}
|
|
27460
27478
|
|
|
27461
|
-
}
|
|
27479
|
+
}
|
|
27462
27480
|
/**
|
|
27463
27481
|
A list of boot-time configuration options for customizing the behavior of
|
|
27464
27482
|
an `ApplicationInstance`.
|
|
@@ -27482,48 +27500,26 @@ define("@ember/application/instance", ["exports", "@ember/-internals/metal", "@e
|
|
|
27482
27500
|
@public
|
|
27483
27501
|
*/
|
|
27484
27502
|
|
|
27485
|
-
|
|
27503
|
+
|
|
27504
|
+
class _BootOptions {
|
|
27486
27505
|
constructor(options) {
|
|
27487
27506
|
if (options === void 0) {
|
|
27488
27507
|
options = {};
|
|
27489
27508
|
}
|
|
27490
27509
|
|
|
27491
27510
|
/**
|
|
27492
|
-
|
|
27493
|
-
|
|
27494
|
-
|
|
27495
|
-
|
|
27496
|
-
@default auto-detected
|
|
27497
|
-
@private
|
|
27498
|
-
*/
|
|
27499
|
-
this.isInteractive = Boolean(environment.hasDOM); // This default is overridable below
|
|
27500
|
-
|
|
27501
|
-
/**
|
|
27502
|
-
@property _renderMode
|
|
27511
|
+
If present, overrides the router's `location` property with this
|
|
27512
|
+
value. This is useful for environments where trying to modify the
|
|
27513
|
+
URL would be inappropriate.
|
|
27514
|
+
@property location
|
|
27503
27515
|
@type string
|
|
27504
|
-
@default
|
|
27505
|
-
@
|
|
27516
|
+
@default null
|
|
27517
|
+
@public
|
|
27506
27518
|
*/
|
|
27519
|
+
this.location = null;
|
|
27520
|
+
this.isInteractive = Boolean(environment.hasDOM); // This default is overridable below
|
|
27507
27521
|
|
|
27508
27522
|
this._renderMode = options._renderMode;
|
|
27509
|
-
/**
|
|
27510
|
-
Run in a full browser environment.
|
|
27511
|
-
When this flag is set to `false`, it will disable most browser-specific
|
|
27512
|
-
and interactive features. Specifically:
|
|
27513
|
-
* It does not use `jQuery` to append the root view; the `rootElement`
|
|
27514
|
-
(either specified as a subsequent option or on the application itself)
|
|
27515
|
-
must already be an `Element` in the given `document` (as opposed to a
|
|
27516
|
-
string selector).
|
|
27517
|
-
* It does not set up an `EventDispatcher`.
|
|
27518
|
-
* It does not run any `Component` lifecycle hooks (such as `didInsertElement`).
|
|
27519
|
-
* It sets the `location` option to `"none"`. (If you would like to use
|
|
27520
|
-
the location adapter specified in the app's router instead, you can also
|
|
27521
|
-
specify `{ location: null }` to specifically opt-out.)
|
|
27522
|
-
@property isBrowser
|
|
27523
|
-
@type boolean
|
|
27524
|
-
@default auto-detected
|
|
27525
|
-
@public
|
|
27526
|
-
*/
|
|
27527
27523
|
|
|
27528
27524
|
if (options.isBrowser !== undefined) {
|
|
27529
27525
|
this.isBrowser = Boolean(options.isBrowser);
|
|
@@ -27535,17 +27531,6 @@ define("@ember/application/instance", ["exports", "@ember/-internals/metal", "@e
|
|
|
27535
27531
|
this.isInteractive = false;
|
|
27536
27532
|
this.location = 'none';
|
|
27537
27533
|
}
|
|
27538
|
-
/**
|
|
27539
|
-
Disable rendering completely.
|
|
27540
|
-
When this flag is set to `false`, it will disable the entire rendering
|
|
27541
|
-
pipeline. Essentially, this puts the app into "routing-only" mode. No
|
|
27542
|
-
templates will be rendered, and no Components will be created.
|
|
27543
|
-
@property shouldRender
|
|
27544
|
-
@type boolean
|
|
27545
|
-
@default true
|
|
27546
|
-
@public
|
|
27547
|
-
*/
|
|
27548
|
-
|
|
27549
27534
|
|
|
27550
27535
|
if (options.shouldRender !== undefined) {
|
|
27551
27536
|
this.shouldRender = Boolean(options.shouldRender);
|
|
@@ -27556,46 +27541,12 @@ define("@ember/application/instance", ["exports", "@ember/-internals/metal", "@e
|
|
|
27556
27541
|
if (!this.shouldRender) {
|
|
27557
27542
|
this.isInteractive = false;
|
|
27558
27543
|
}
|
|
27559
|
-
/**
|
|
27560
|
-
If present, render into the given `Document` object instead of the
|
|
27561
|
-
global `window.document` object.
|
|
27562
|
-
In practice, this is only useful in non-browser environment or in
|
|
27563
|
-
non-interactive mode, because Ember's `jQuery` dependency is
|
|
27564
|
-
implicitly bound to the current document, causing event delegation
|
|
27565
|
-
to not work properly when the app is rendered into a foreign
|
|
27566
|
-
document object (such as an iframe's `contentDocument`).
|
|
27567
|
-
In non-browser mode, this could be a "`Document`-like" object as
|
|
27568
|
-
Ember only interact with a small subset of the DOM API in non-
|
|
27569
|
-
interactive mode. While the exact requirements have not yet been
|
|
27570
|
-
formalized, the `SimpleDOM` library's implementation is known to
|
|
27571
|
-
work.
|
|
27572
|
-
@property document
|
|
27573
|
-
@type Document
|
|
27574
|
-
@default the global `document` object
|
|
27575
|
-
@public
|
|
27576
|
-
*/
|
|
27577
|
-
|
|
27578
27544
|
|
|
27579
27545
|
if (options.document) {
|
|
27580
27546
|
this.document = options.document;
|
|
27581
27547
|
} else {
|
|
27582
27548
|
this.document = typeof document !== 'undefined' ? document : null;
|
|
27583
27549
|
}
|
|
27584
|
-
/**
|
|
27585
|
-
If present, overrides the application's `rootElement` property on
|
|
27586
|
-
the instance. This is useful for testing environment, where you
|
|
27587
|
-
might want to append the root view to a fixture area.
|
|
27588
|
-
In non-browser mode, because Ember does not have access to jQuery,
|
|
27589
|
-
this options must be specified as a DOM `Element` object instead of
|
|
27590
|
-
a selector string.
|
|
27591
|
-
See the documentation on `Application`'s `rootElement` for
|
|
27592
|
-
details.
|
|
27593
|
-
@property rootElement
|
|
27594
|
-
@type String|Element
|
|
27595
|
-
@default null
|
|
27596
|
-
@public
|
|
27597
|
-
*/
|
|
27598
|
-
|
|
27599
27550
|
|
|
27600
27551
|
if (options.rootElement) {
|
|
27601
27552
|
this.rootElement = options.rootElement;
|
|
@@ -27603,16 +27554,6 @@ define("@ember/application/instance", ["exports", "@ember/-internals/metal", "@e
|
|
|
27603
27554
|
// defaults from the "combo" options like `isBrowser` (although in
|
|
27604
27555
|
// practice, the resulting combination is probably invalid)
|
|
27605
27556
|
|
|
27606
|
-
/**
|
|
27607
|
-
If present, overrides the router's `location` property with this
|
|
27608
|
-
value. This is useful for environments where trying to modify the
|
|
27609
|
-
URL would be inappropriate.
|
|
27610
|
-
@property location
|
|
27611
|
-
@type string
|
|
27612
|
-
@default null
|
|
27613
|
-
@public
|
|
27614
|
-
*/
|
|
27615
|
-
|
|
27616
27557
|
|
|
27617
27558
|
if (options.location !== undefined) {
|
|
27618
27559
|
this.location = options.location;
|
|
@@ -27625,13 +27566,13 @@ define("@ember/application/instance", ["exports", "@ember/-internals/metal", "@e
|
|
|
27625
27566
|
|
|
27626
27567
|
toEnvironment() {
|
|
27627
27568
|
// Do we really want to assign all of this!?
|
|
27628
|
-
|
|
27629
|
-
|
|
27630
|
-
|
|
27631
|
-
|
|
27632
|
-
|
|
27633
|
-
|
|
27634
|
-
|
|
27569
|
+
return Object.assign(Object.assign({}, environment), {
|
|
27570
|
+
// For compatibility with existing code
|
|
27571
|
+
hasDOM: this.isBrowser,
|
|
27572
|
+
isInteractive: this.isInteractive,
|
|
27573
|
+
_renderMode: this._renderMode,
|
|
27574
|
+
options: this
|
|
27575
|
+
});
|
|
27635
27576
|
}
|
|
27636
27577
|
|
|
27637
27578
|
}
|
|
@@ -27801,149 +27742,56 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
27801
27742
|
|
|
27802
27743
|
@class Application
|
|
27803
27744
|
@extends Engine
|
|
27804
|
-
@uses RegistryProxyMixin
|
|
27805
27745
|
@public
|
|
27806
27746
|
*/
|
|
27807
|
-
|
|
27808
|
-
|
|
27809
|
-
|
|
27810
|
-
|
|
27811
|
-
|
|
27812
|
-
|
|
27813
|
-
view in your application should be a child of the element you specify here.
|
|
27814
|
-
@property rootElement
|
|
27815
|
-
@type DOMElement
|
|
27816
|
-
@default 'body'
|
|
27817
|
-
@public
|
|
27818
|
-
*/
|
|
27819
|
-
rootElement: 'body',
|
|
27820
|
-
|
|
27747
|
+
class Application extends _engine.default {
|
|
27748
|
+
constructor() {
|
|
27749
|
+
super(...arguments);
|
|
27750
|
+
this._bootPromise = null;
|
|
27751
|
+
this._bootResolver = null;
|
|
27752
|
+
}
|
|
27821
27753
|
/**
|
|
27822
|
-
|
|
27823
|
-
|
|
27824
|
-
|
|
27754
|
+
This creates a registry with the default Ember naming conventions.
|
|
27755
|
+
It also configures the registry:
|
|
27756
|
+
* registered views are created every time they are looked up (they are
|
|
27757
|
+
not singletons)
|
|
27758
|
+
* registered templates are not factories; the registered value is
|
|
27759
|
+
returned directly.
|
|
27760
|
+
* the router receives the application as its `namespace` property
|
|
27761
|
+
* all controllers receive the router as their `target` and `controllers`
|
|
27762
|
+
properties
|
|
27763
|
+
* all controllers receive the application as their `namespace` property
|
|
27764
|
+
* the application view receives the application controller as its
|
|
27765
|
+
`controller` property
|
|
27766
|
+
* the application view receives the application template as its
|
|
27767
|
+
`defaultTemplate` property
|
|
27768
|
+
@method buildRegistry
|
|
27769
|
+
@static
|
|
27770
|
+
@param {Application} namespace the application for which to
|
|
27771
|
+
build the registry
|
|
27772
|
+
@return {Ember.Registry} the built registry
|
|
27825
27773
|
@private
|
|
27826
27774
|
*/
|
|
27827
|
-
_document: _browserEnvironment.hasDOM ? window.document : null,
|
|
27828
|
-
|
|
27829
|
-
/**
|
|
27830
|
-
The `Ember.EventDispatcher` responsible for delegating events to this
|
|
27831
|
-
application's views.
|
|
27832
|
-
The event dispatcher is created by the application at initialization time
|
|
27833
|
-
and sets up event listeners on the DOM element described by the
|
|
27834
|
-
application's `rootElement` property.
|
|
27835
|
-
See the documentation for `Ember.EventDispatcher` for more information.
|
|
27836
|
-
@property eventDispatcher
|
|
27837
|
-
@type Ember.EventDispatcher
|
|
27838
|
-
@default null
|
|
27839
|
-
@public
|
|
27840
|
-
*/
|
|
27841
|
-
eventDispatcher: null,
|
|
27842
|
-
|
|
27843
|
-
/**
|
|
27844
|
-
The DOM events for which the event dispatcher should listen.
|
|
27845
|
-
By default, the application's `Ember.EventDispatcher` listens
|
|
27846
|
-
for a set of standard DOM events, such as `mousedown` and
|
|
27847
|
-
`keyup`, and delegates them to your application's `Ember.View`
|
|
27848
|
-
instances.
|
|
27849
|
-
If you would like additional bubbling events to be delegated to your
|
|
27850
|
-
views, set your `Application`'s `customEvents` property
|
|
27851
|
-
to a hash containing the DOM event name as the key and the
|
|
27852
|
-
corresponding view method name as the value. Setting an event to
|
|
27853
|
-
a value of `null` will prevent a default event listener from being
|
|
27854
|
-
added for that event.
|
|
27855
|
-
To add new events to be listened to:
|
|
27856
|
-
```app/app.js
|
|
27857
|
-
import Application from '@ember/application';
|
|
27858
|
-
let App = Application.extend({
|
|
27859
|
-
customEvents: {
|
|
27860
|
-
// add support for the paste event
|
|
27861
|
-
paste: 'paste'
|
|
27862
|
-
}
|
|
27863
|
-
});
|
|
27864
|
-
```
|
|
27865
|
-
To prevent default events from being listened to:
|
|
27866
|
-
```app/app.js
|
|
27867
|
-
import Application from '@ember/application';
|
|
27868
|
-
let App = Application.extend({
|
|
27869
|
-
customEvents: {
|
|
27870
|
-
// remove support for mouseenter / mouseleave events
|
|
27871
|
-
mouseenter: null,
|
|
27872
|
-
mouseleave: null
|
|
27873
|
-
}
|
|
27874
|
-
});
|
|
27875
|
-
```
|
|
27876
|
-
@property customEvents
|
|
27877
|
-
@type Object
|
|
27878
|
-
@default null
|
|
27879
|
-
@public
|
|
27880
|
-
*/
|
|
27881
|
-
customEvents: null,
|
|
27882
27775
|
|
|
27883
|
-
/**
|
|
27884
|
-
Whether the application should automatically start routing and render
|
|
27885
|
-
templates to the `rootElement` on DOM ready. While default by true,
|
|
27886
|
-
other environments such as FastBoot or a testing harness can set this
|
|
27887
|
-
property to `false` and control the precise timing and behavior of the boot
|
|
27888
|
-
process.
|
|
27889
|
-
@property autoboot
|
|
27890
|
-
@type Boolean
|
|
27891
|
-
@default true
|
|
27892
|
-
@private
|
|
27893
|
-
*/
|
|
27894
|
-
autoboot: true,
|
|
27895
27776
|
|
|
27896
|
-
|
|
27897
|
-
|
|
27898
|
-
|
|
27899
|
-
|
|
27900
|
-
|
|
27901
|
-
|
|
27902
|
-
import Component from '@ember/component';
|
|
27903
|
-
let App = Application.create({
|
|
27904
|
-
...
|
|
27905
|
-
});
|
|
27906
|
-
App.Router.reopen({
|
|
27907
|
-
location: 'none'
|
|
27908
|
-
});
|
|
27909
|
-
App.Router.map({
|
|
27910
|
-
...
|
|
27911
|
-
});
|
|
27912
|
-
App.MyComponent = Component.extend({
|
|
27913
|
-
...
|
|
27914
|
-
});
|
|
27915
|
-
```
|
|
27916
|
-
This flag also exposes other internal APIs that assumes the existence of
|
|
27917
|
-
a special "default instance", like `App.__container__.lookup(...)`.
|
|
27918
|
-
This option is currently not configurable, its value is derived from
|
|
27919
|
-
the `autoboot` flag – disabling `autoboot` also implies opting-out of
|
|
27920
|
-
globals mode support, although they are ultimately orthogonal concerns.
|
|
27921
|
-
Some of the global modes features are already deprecated in 1.x. The
|
|
27922
|
-
existence of this flag is to untangle the globals mode code paths from
|
|
27923
|
-
the autoboot code paths, so that these legacy features can be reviewed
|
|
27924
|
-
for deprecation/removal separately.
|
|
27925
|
-
Forcing the (autoboot=true, _globalsMode=false) here and running the tests
|
|
27926
|
-
would reveal all the places where we are still relying on these legacy
|
|
27927
|
-
behavior internally (mostly just tests).
|
|
27928
|
-
@property _globalsMode
|
|
27929
|
-
@type Boolean
|
|
27930
|
-
@default true
|
|
27931
|
-
@private
|
|
27932
|
-
*/
|
|
27933
|
-
_globalsMode: true,
|
|
27777
|
+
static buildRegistry(namespace) {
|
|
27778
|
+
var registry = super.buildRegistry(namespace);
|
|
27779
|
+
commonSetupRegistry(registry);
|
|
27780
|
+
(0, _glimmer.setupApplicationRegistry)(registry);
|
|
27781
|
+
return registry;
|
|
27782
|
+
}
|
|
27934
27783
|
|
|
27935
|
-
|
|
27936
|
-
|
|
27937
|
-
internally to ensure that all instances get destroyed.
|
|
27938
|
-
@property _applicationInstances
|
|
27939
|
-
@type Array
|
|
27940
|
-
@default null
|
|
27941
|
-
@private
|
|
27942
|
-
*/
|
|
27943
|
-
_applicationInstances: null,
|
|
27784
|
+
init(properties) {
|
|
27785
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
27944
27786
|
|
|
27945
|
-
|
|
27946
|
-
this.
|
|
27787
|
+
super.init(properties);
|
|
27788
|
+
(_a = this.rootElement) !== null && _a !== void 0 ? _a : this.rootElement = 'body';
|
|
27789
|
+
(_b = this._document) !== null && _b !== void 0 ? _b : this._document = null;
|
|
27790
|
+
(_c = this.eventDispatcher) !== null && _c !== void 0 ? _c : this.eventDispatcher = null;
|
|
27791
|
+
(_d = this.customEvents) !== null && _d !== void 0 ? _d : this.customEvents = null;
|
|
27792
|
+
(_e = this.autoboot) !== null && _e !== void 0 ? _e : this.autoboot = true;
|
|
27793
|
+
(_f = this._document) !== null && _f !== void 0 ? _f : this._document = _browserEnvironment.hasDOM ? window.document : null;
|
|
27794
|
+
(_g = this._globalsMode) !== null && _g !== void 0 ? _g : this._globalsMode = true;
|
|
27947
27795
|
|
|
27948
27796
|
if (true
|
|
27949
27797
|
/* DEBUG */
|
|
@@ -27951,8 +27799,7 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
27951
27799
|
if (_environment.ENV.LOG_VERSION) {
|
|
27952
27800
|
// we only need to see this once per Application#init
|
|
27953
27801
|
_environment.ENV.LOG_VERSION = false;
|
|
27954
|
-
|
|
27955
|
-
_metal.libraries.logVersions();
|
|
27802
|
+
(_h = _metal.libraries.logVersions) === null || _h === void 0 ? void 0 : _h.call(_metal.libraries);
|
|
27956
27803
|
}
|
|
27957
27804
|
} // Start off the number of deferrals at 1. This will be decremented by
|
|
27958
27805
|
// the Application's own `boot` method.
|
|
@@ -27970,14 +27817,15 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
27970
27817
|
if (this.autoboot) {
|
|
27971
27818
|
this.waitForDOMReady();
|
|
27972
27819
|
}
|
|
27973
|
-
}
|
|
27974
|
-
|
|
27820
|
+
}
|
|
27975
27821
|
/**
|
|
27976
27822
|
Create an ApplicationInstance for this application.
|
|
27977
|
-
|
|
27823
|
+
@public
|
|
27978
27824
|
@method buildInstance
|
|
27979
27825
|
@return {ApplicationInstance} the application instance
|
|
27980
27826
|
*/
|
|
27827
|
+
|
|
27828
|
+
|
|
27981
27829
|
buildInstance(options) {
|
|
27982
27830
|
if (options === void 0) {
|
|
27983
27831
|
options = {};
|
|
@@ -27985,40 +27833,44 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
27985
27833
|
|
|
27986
27834
|
(true && !(!this.isDestroyed) && (0, _debug.assert)('You cannot build new instances of this application since it has already been destroyed', !this.isDestroyed));
|
|
27987
27835
|
(true && !(!this.isDestroying) && (0, _debug.assert)('You cannot build new instances of this application since it is being destroyed', !this.isDestroying));
|
|
27988
|
-
|
|
27989
|
-
|
|
27990
|
-
|
|
27991
|
-
|
|
27992
|
-
|
|
27836
|
+
return _instance.default.create(Object.assign(Object.assign({}, options), {
|
|
27837
|
+
base: this,
|
|
27838
|
+
application: this
|
|
27839
|
+
}));
|
|
27840
|
+
}
|
|
27993
27841
|
/**
|
|
27994
27842
|
Start tracking an ApplicationInstance for this application.
|
|
27995
27843
|
Used when the ApplicationInstance is created.
|
|
27996
|
-
|
|
27844
|
+
@private
|
|
27997
27845
|
@method _watchInstance
|
|
27998
27846
|
*/
|
|
27847
|
+
|
|
27848
|
+
|
|
27999
27849
|
_watchInstance(instance) {
|
|
28000
27850
|
this._applicationInstances.add(instance);
|
|
28001
|
-
}
|
|
28002
|
-
|
|
27851
|
+
}
|
|
28003
27852
|
/**
|
|
28004
27853
|
Stop tracking an ApplicationInstance for this application.
|
|
28005
27854
|
Used when the ApplicationInstance is about to be destroyed.
|
|
28006
|
-
|
|
27855
|
+
@private
|
|
28007
27856
|
@method _unwatchInstance
|
|
28008
27857
|
*/
|
|
27858
|
+
|
|
27859
|
+
|
|
28009
27860
|
_unwatchInstance(instance) {
|
|
28010
27861
|
return this._applicationInstances.delete(instance);
|
|
28011
|
-
}
|
|
28012
|
-
|
|
27862
|
+
}
|
|
28013
27863
|
/**
|
|
28014
27864
|
Enable the legacy globals mode by allowing this application to act
|
|
28015
27865
|
as a global namespace. See the docs on the `_globalsMode` property
|
|
28016
27866
|
for details.
|
|
28017
|
-
|
|
27867
|
+
Most of these features are already deprecated in 1.x, so we can
|
|
28018
27868
|
stop using them internally and try to remove them.
|
|
28019
|
-
|
|
27869
|
+
@private
|
|
28020
27870
|
@method _prepareForGlobalsMode
|
|
28021
27871
|
*/
|
|
27872
|
+
|
|
27873
|
+
|
|
28022
27874
|
_prepareForGlobalsMode() {
|
|
28023
27875
|
// Create subclass of Router for this Application instance.
|
|
28024
27876
|
// This is to ensure that someone reopening `App.Router` does not
|
|
@@ -28026,20 +27878,21 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28026
27878
|
this.Router = (this.Router || _routing.Router).extend();
|
|
28027
27879
|
|
|
28028
27880
|
this._buildDeprecatedInstance();
|
|
28029
|
-
}
|
|
28030
|
-
|
|
27881
|
+
}
|
|
28031
27882
|
/*
|
|
28032
27883
|
Build the deprecated instance for legacy globals mode support.
|
|
28033
27884
|
Called when creating and resetting the application.
|
|
28034
|
-
|
|
27885
|
+
This is orthogonal to autoboot: the deprecated instance needs to
|
|
28035
27886
|
be created at Application construction (not boot) time to expose
|
|
28036
27887
|
App.__container__. If autoboot sees that this instance exists,
|
|
28037
27888
|
it will continue booting it to avoid doing unncessary work (as
|
|
28038
27889
|
opposed to building a new instance at boot time), but they are
|
|
28039
27890
|
otherwise unrelated.
|
|
28040
|
-
|
|
27891
|
+
@private
|
|
28041
27892
|
@method _buildDeprecatedInstance
|
|
28042
27893
|
*/
|
|
27894
|
+
|
|
27895
|
+
|
|
28043
27896
|
_buildDeprecatedInstance() {
|
|
28044
27897
|
// Build a default instance
|
|
28045
27898
|
var instance = this.buildInstance(); // Legacy support for App.__container__ and other global methods
|
|
@@ -28047,42 +27900,43 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28047
27900
|
|
|
28048
27901
|
this.__deprecatedInstance__ = instance;
|
|
28049
27902
|
this.__container__ = instance.__container__;
|
|
28050
|
-
}
|
|
28051
|
-
|
|
27903
|
+
}
|
|
28052
27904
|
/**
|
|
28053
27905
|
Automatically kick-off the boot process for the application once the
|
|
28054
27906
|
DOM has become ready.
|
|
28055
|
-
|
|
27907
|
+
The initialization itself is scheduled on the actions queue which
|
|
28056
27908
|
ensures that code-loading finishes before booting.
|
|
28057
|
-
|
|
27909
|
+
If you are asynchronously loading code, you should call `deferReadiness()`
|
|
28058
27910
|
to defer booting, and then call `advanceReadiness()` once all of your code
|
|
28059
27911
|
has finished loading.
|
|
28060
|
-
|
|
27912
|
+
@private
|
|
28061
27913
|
@method waitForDOMReady
|
|
28062
27914
|
*/
|
|
27915
|
+
|
|
27916
|
+
|
|
28063
27917
|
waitForDOMReady() {
|
|
28064
|
-
|
|
28065
|
-
|
|
27918
|
+
var document = this._document;
|
|
27919
|
+
|
|
27920
|
+
if (document === null || document.readyState !== 'loading') {
|
|
27921
|
+
(0, _runloop.schedule)('actions', this, this.domReady);
|
|
28066
27922
|
} else {
|
|
28067
27923
|
var callback = () => {
|
|
28068
|
-
|
|
28069
|
-
|
|
28070
|
-
(0, _runloop.run)(this, 'domReady');
|
|
27924
|
+
document.removeEventListener('DOMContentLoaded', callback);
|
|
27925
|
+
(0, _runloop.run)(this, this.domReady);
|
|
28071
27926
|
};
|
|
28072
27927
|
|
|
28073
|
-
|
|
27928
|
+
document.addEventListener('DOMContentLoaded', callback);
|
|
28074
27929
|
}
|
|
28075
|
-
}
|
|
28076
|
-
|
|
27930
|
+
}
|
|
28077
27931
|
/**
|
|
28078
27932
|
This is the autoboot flow:
|
|
28079
|
-
|
|
27933
|
+
1. Boot the app by calling `this.boot()`
|
|
28080
27934
|
2. Create an instance (or use the `__deprecatedInstance__` in globals mode)
|
|
28081
27935
|
3. Boot the instance by calling `instance.boot()`
|
|
28082
27936
|
4. Invoke the `App.ready()` callback
|
|
28083
27937
|
5. Kick-off routing on the instance
|
|
28084
|
-
|
|
28085
|
-
|
|
27938
|
+
Ideally, this is all we would need to do:
|
|
27939
|
+
```javascript
|
|
28086
27940
|
_autoBoot() {
|
|
28087
27941
|
this.boot().then(() => {
|
|
28088
27942
|
let instance = (this._globalsMode) ? this.__deprecatedInstance__ : this.buildInstance();
|
|
@@ -28093,16 +27947,18 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28093
27947
|
});
|
|
28094
27948
|
}
|
|
28095
27949
|
```
|
|
28096
|
-
|
|
27950
|
+
Unfortunately, we cannot actually write this because we need to participate
|
|
28097
27951
|
in the "synchronous" boot process. While the code above would work fine on
|
|
28098
27952
|
the initial boot (i.e. DOM ready), when `App.reset()` is called, we need to
|
|
28099
27953
|
boot a new instance synchronously (see the documentation on `_bootSync()`
|
|
28100
27954
|
for details).
|
|
28101
|
-
|
|
27955
|
+
Because of this restriction, the actual logic of this method is located
|
|
28102
27956
|
inside `didBecomeReady()`.
|
|
28103
|
-
|
|
27957
|
+
@private
|
|
28104
27958
|
@method domReady
|
|
28105
27959
|
*/
|
|
27960
|
+
|
|
27961
|
+
|
|
28106
27962
|
domReady() {
|
|
28107
27963
|
if (this.isDestroying || this.isDestroyed) {
|
|
28108
27964
|
return;
|
|
@@ -28110,45 +27966,47 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28110
27966
|
|
|
28111
27967
|
this._bootSync(); // Continues to `didBecomeReady`
|
|
28112
27968
|
|
|
28113
|
-
}
|
|
28114
|
-
|
|
27969
|
+
}
|
|
28115
27970
|
/**
|
|
28116
27971
|
Use this to defer readiness until some condition is true.
|
|
28117
|
-
|
|
28118
|
-
|
|
27972
|
+
Example:
|
|
27973
|
+
```javascript
|
|
28119
27974
|
import Application from '@ember/application';
|
|
28120
|
-
|
|
28121
|
-
|
|
28122
|
-
|
|
27975
|
+
let App = Application.create();
|
|
27976
|
+
App.deferReadiness();
|
|
27977
|
+
fetch('/auth-token')
|
|
28123
27978
|
.then(response => response.json())
|
|
28124
27979
|
.then(data => {
|
|
28125
27980
|
App.token = data.token;
|
|
28126
27981
|
App.advanceReadiness();
|
|
28127
27982
|
});
|
|
28128
27983
|
```
|
|
28129
|
-
|
|
27984
|
+
This allows you to perform asynchronous setup logic and defer
|
|
28130
27985
|
booting your application until the setup has finished.
|
|
28131
|
-
|
|
27986
|
+
However, if the setup requires a loading UI, it might be better
|
|
28132
27987
|
to use the router for this purpose.
|
|
28133
|
-
|
|
27988
|
+
@method deferReadiness
|
|
28134
27989
|
@public
|
|
28135
27990
|
*/
|
|
27991
|
+
|
|
27992
|
+
|
|
28136
27993
|
deferReadiness() {
|
|
28137
27994
|
(true && !(this instanceof Application) && (0, _debug.assert)('You must call deferReadiness on an instance of Application', this instanceof Application));
|
|
28138
27995
|
(true && !(!this.isDestroyed) && (0, _debug.assert)('You cannot defer readiness since application has already destroyed', !this.isDestroyed));
|
|
28139
27996
|
(true && !(!this.isDestroying) && (0, _debug.assert)('You cannot defer readiness since the application is being destroyed', !this.isDestroying));
|
|
28140
27997
|
(true && !(this._readinessDeferrals > 0) && (0, _debug.assert)('You cannot defer readiness since the `ready()` hook has already been called', this._readinessDeferrals > 0));
|
|
28141
27998
|
this._readinessDeferrals++;
|
|
28142
|
-
}
|
|
28143
|
-
|
|
27999
|
+
}
|
|
28144
28000
|
/**
|
|
28145
28001
|
Call `advanceReadiness` after any asynchronous setup logic has completed.
|
|
28146
28002
|
Each call to `deferReadiness` must be matched by a call to `advanceReadiness`
|
|
28147
28003
|
or the application will never become ready and routing will not begin.
|
|
28148
|
-
|
|
28004
|
+
@method advanceReadiness
|
|
28149
28005
|
@see {Application#deferReadiness}
|
|
28150
28006
|
@public
|
|
28151
28007
|
*/
|
|
28008
|
+
|
|
28009
|
+
|
|
28152
28010
|
advanceReadiness() {
|
|
28153
28011
|
(true && !(this instanceof Application) && (0, _debug.assert)('You must call advanceReadiness on an instance of Application', this instanceof Application));
|
|
28154
28012
|
(true && !(!this.isDestroyed) && (0, _debug.assert)('You cannot advance readiness since application has already destroyed', !this.isDestroyed));
|
|
@@ -28159,21 +28017,22 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28159
28017
|
if (this._readinessDeferrals === 0) {
|
|
28160
28018
|
(0, _runloop.once)(this, this.didBecomeReady);
|
|
28161
28019
|
}
|
|
28162
|
-
}
|
|
28163
|
-
|
|
28020
|
+
}
|
|
28164
28021
|
/**
|
|
28165
28022
|
Initialize the application and return a promise that resolves with the `Application`
|
|
28166
28023
|
object when the boot process is complete.
|
|
28167
|
-
|
|
28024
|
+
Run any application initializers and run the application load hook. These hooks may
|
|
28168
28025
|
choose to defer readiness. For example, an authentication hook might want to defer
|
|
28169
28026
|
readiness until the auth token has been retrieved.
|
|
28170
|
-
|
|
28027
|
+
By default, this method is called automatically on "DOM ready"; however, if autoboot
|
|
28171
28028
|
is disabled, this is automatically called when the first application instance is
|
|
28172
28029
|
created via `visit`.
|
|
28173
|
-
|
|
28030
|
+
@public
|
|
28174
28031
|
@method boot
|
|
28175
28032
|
@return {Promise<Application,Error>}
|
|
28176
28033
|
*/
|
|
28034
|
+
|
|
28035
|
+
|
|
28177
28036
|
boot() {
|
|
28178
28037
|
(true && !(!this.isDestroyed) && (0, _debug.assert)('You cannot boot this application since it has already been destroyed', !this.isDestroyed));
|
|
28179
28038
|
(true && !(!this.isDestroying) && (0, _debug.assert)('You cannot boot this application since it is being destroyed', !this.isDestroying));
|
|
@@ -28188,20 +28047,22 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28188
28047
|
// in the promise rejection
|
|
28189
28048
|
}
|
|
28190
28049
|
|
|
28050
|
+
(true && !(this._bootPromise) && (0, _debug.assert)('has boot promise', this._bootPromise));
|
|
28191
28051
|
return this._bootPromise;
|
|
28192
|
-
}
|
|
28193
|
-
|
|
28052
|
+
}
|
|
28194
28053
|
/**
|
|
28195
28054
|
Unfortunately, a lot of existing code assumes the booting process is
|
|
28196
28055
|
"synchronous". Specifically, a lot of tests assumes the last call to
|
|
28197
28056
|
`app.advanceReadiness()` or `app.reset()` will result in the app being
|
|
28198
28057
|
fully-booted when the current runloop completes.
|
|
28199
|
-
|
|
28058
|
+
We would like new code (like the `visit` API) to stop making this assumption,
|
|
28200
28059
|
so we created the asynchronous version above that returns a promise. But until
|
|
28201
28060
|
we have migrated all the code, we would have to expose this method for use
|
|
28202
28061
|
*internally* in places where we need to boot an app "synchronously".
|
|
28203
|
-
|
|
28062
|
+
@private
|
|
28204
28063
|
*/
|
|
28064
|
+
|
|
28065
|
+
|
|
28205
28066
|
_bootSync() {
|
|
28206
28067
|
if (this._booted || this.isDestroying || this.isDestroyed) {
|
|
28207
28068
|
return;
|
|
@@ -28225,45 +28086,44 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28225
28086
|
|
|
28226
28087
|
throw error;
|
|
28227
28088
|
}
|
|
28228
|
-
}
|
|
28229
|
-
|
|
28089
|
+
}
|
|
28230
28090
|
/**
|
|
28231
28091
|
Reset the application. This is typically used only in tests. It cleans up
|
|
28232
28092
|
the application in the following order:
|
|
28233
|
-
|
|
28093
|
+
1. Deactivate existing routes
|
|
28234
28094
|
2. Destroy all objects in the container
|
|
28235
28095
|
3. Create a new application container
|
|
28236
28096
|
4. Re-route to the existing url
|
|
28237
|
-
|
|
28238
|
-
|
|
28097
|
+
Typical Example:
|
|
28098
|
+
```javascript
|
|
28239
28099
|
import Application from '@ember/application';
|
|
28240
28100
|
let App;
|
|
28241
|
-
|
|
28101
|
+
run(function() {
|
|
28242
28102
|
App = Application.create();
|
|
28243
28103
|
});
|
|
28244
|
-
|
|
28104
|
+
module('acceptance test', {
|
|
28245
28105
|
setup: function() {
|
|
28246
28106
|
App.reset();
|
|
28247
28107
|
}
|
|
28248
28108
|
});
|
|
28249
|
-
|
|
28109
|
+
test('first test', function() {
|
|
28250
28110
|
// App is freshly reset
|
|
28251
28111
|
});
|
|
28252
|
-
|
|
28112
|
+
test('second test', function() {
|
|
28253
28113
|
// App is again freshly reset
|
|
28254
28114
|
});
|
|
28255
28115
|
```
|
|
28256
|
-
|
|
28257
|
-
|
|
28116
|
+
Advanced Example:
|
|
28117
|
+
Occasionally you may want to prevent the app from initializing during
|
|
28258
28118
|
setup. This could enable extra configuration, or enable asserting prior
|
|
28259
28119
|
to the app becoming ready.
|
|
28260
|
-
|
|
28120
|
+
```javascript
|
|
28261
28121
|
import Application from '@ember/application';
|
|
28262
28122
|
let App;
|
|
28263
|
-
|
|
28123
|
+
run(function() {
|
|
28264
28124
|
App = Application.create();
|
|
28265
28125
|
});
|
|
28266
|
-
|
|
28126
|
+
module('acceptance test', {
|
|
28267
28127
|
setup: function() {
|
|
28268
28128
|
run(function() {
|
|
28269
28129
|
App.reset();
|
|
@@ -28271,17 +28131,19 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28271
28131
|
});
|
|
28272
28132
|
}
|
|
28273
28133
|
});
|
|
28274
|
-
|
|
28134
|
+
test('first test', function() {
|
|
28275
28135
|
ok(true, 'something before app is initialized');
|
|
28276
|
-
|
|
28136
|
+
run(function() {
|
|
28277
28137
|
App.advanceReadiness();
|
|
28278
28138
|
});
|
|
28279
|
-
|
|
28139
|
+
ok(true, 'something after app is initialized');
|
|
28280
28140
|
});
|
|
28281
28141
|
```
|
|
28282
|
-
|
|
28142
|
+
@method reset
|
|
28283
28143
|
@public
|
|
28284
28144
|
*/
|
|
28145
|
+
|
|
28146
|
+
|
|
28285
28147
|
reset() {
|
|
28286
28148
|
(true && !(!this.isDestroyed) && (0, _debug.assert)('You cannot reset this application since it has already been destroyed', !this.isDestroyed));
|
|
28287
28149
|
(true && !(!this.isDestroying) && (0, _debug.assert)('You cannot reset this application since it is being destroyed', !this.isDestroying));
|
|
@@ -28296,6 +28158,7 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28296
28158
|
this._booted = false;
|
|
28297
28159
|
|
|
28298
28160
|
function handleReset() {
|
|
28161
|
+
(true && !(instance) && (0, _debug.assert)('expected instance', instance));
|
|
28299
28162
|
(0, _runloop.run)(instance, 'destroy');
|
|
28300
28163
|
|
|
28301
28164
|
this._buildDeprecatedInstance();
|
|
@@ -28304,17 +28167,20 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28304
28167
|
}
|
|
28305
28168
|
|
|
28306
28169
|
(0, _runloop.join)(this, handleReset);
|
|
28307
|
-
}
|
|
28308
|
-
|
|
28170
|
+
}
|
|
28309
28171
|
/**
|
|
28310
28172
|
@private
|
|
28311
28173
|
@method didBecomeReady
|
|
28312
28174
|
*/
|
|
28175
|
+
|
|
28176
|
+
|
|
28313
28177
|
didBecomeReady() {
|
|
28314
28178
|
if (this.isDestroying || this.isDestroyed) {
|
|
28315
28179
|
return;
|
|
28316
28180
|
}
|
|
28317
28181
|
|
|
28182
|
+
(true && !(this._bootResolver) && (0, _debug.assert)('expected _bootResolver', this._bootResolver));
|
|
28183
|
+
|
|
28318
28184
|
try {
|
|
28319
28185
|
// TODO: Is this still needed for _globalsMode = false?
|
|
28320
28186
|
// See documentation on `_autoboot()` for details
|
|
@@ -28325,6 +28191,7 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28325
28191
|
// If we already have the __deprecatedInstance__ lying around, boot it to
|
|
28326
28192
|
// avoid unnecessary work
|
|
28327
28193
|
instance = this.__deprecatedInstance__;
|
|
28194
|
+
(true && !(instance) && (0, _debug.assert)('expected instance', instance));
|
|
28328
28195
|
} else {
|
|
28329
28196
|
// Otherwise, build an instance and boot it. This is currently unreachable,
|
|
28330
28197
|
// because we forced _globalsMode to === autoboot; but having this branch
|
|
@@ -28352,24 +28219,25 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28352
28219
|
|
|
28353
28220
|
throw error;
|
|
28354
28221
|
}
|
|
28355
|
-
}
|
|
28356
|
-
|
|
28222
|
+
}
|
|
28357
28223
|
/**
|
|
28358
28224
|
Called when the Application has become ready, immediately before routing
|
|
28359
28225
|
begins. The call will be delayed until the DOM has become ready.
|
|
28360
|
-
|
|
28226
|
+
@event ready
|
|
28361
28227
|
@public
|
|
28362
28228
|
*/
|
|
28229
|
+
|
|
28230
|
+
|
|
28363
28231
|
ready() {
|
|
28364
28232
|
return this;
|
|
28365
|
-
}
|
|
28233
|
+
} // This method must be moved to the application instance object
|
|
28234
|
+
|
|
28366
28235
|
|
|
28367
|
-
// This method must be moved to the application instance object
|
|
28368
28236
|
willDestroy() {
|
|
28369
|
-
|
|
28237
|
+
super.willDestroy();
|
|
28370
28238
|
|
|
28371
|
-
if (_lazy_load._loaded
|
|
28372
|
-
_lazy_load._loaded
|
|
28239
|
+
if (_lazy_load._loaded['application'] === this) {
|
|
28240
|
+
_lazy_load._loaded['application'] = undefined;
|
|
28373
28241
|
}
|
|
28374
28242
|
|
|
28375
28243
|
if (this._applicationInstances.size) {
|
|
@@ -28377,86 +28245,85 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28377
28245
|
|
|
28378
28246
|
this._applicationInstances.clear();
|
|
28379
28247
|
}
|
|
28380
|
-
}
|
|
28381
|
-
|
|
28248
|
+
}
|
|
28382
28249
|
/**
|
|
28383
28250
|
Boot a new instance of `ApplicationInstance` for the current
|
|
28384
28251
|
application and navigate it to the given `url`. Returns a `Promise` that
|
|
28385
28252
|
resolves with the instance when the initial routing and rendering is
|
|
28386
28253
|
complete, or rejects with any error that occurred during the boot process.
|
|
28387
|
-
|
|
28254
|
+
When `autoboot` is disabled, calling `visit` would first cause the
|
|
28388
28255
|
application to boot, which runs the application initializers.
|
|
28389
|
-
|
|
28256
|
+
This method also takes a hash of boot-time configuration options for
|
|
28390
28257
|
customizing the instance's behavior. See the documentation on
|
|
28391
28258
|
`ApplicationInstance.BootOptions` for details.
|
|
28392
|
-
|
|
28259
|
+
`ApplicationInstance.BootOptions` is an interface class that exists
|
|
28393
28260
|
purely to document the available options; you do not need to construct it
|
|
28394
28261
|
manually. Simply pass a regular JavaScript object containing of the
|
|
28395
28262
|
desired options:
|
|
28396
|
-
|
|
28263
|
+
```javascript
|
|
28397
28264
|
MyApp.visit("/", { location: "none", rootElement: "#container" });
|
|
28398
28265
|
```
|
|
28399
|
-
|
|
28400
|
-
|
|
28266
|
+
### Supported Scenarios
|
|
28267
|
+
While the `BootOptions` class exposes a large number of knobs, not all
|
|
28401
28268
|
combinations of them are valid; certain incompatible combinations might
|
|
28402
28269
|
result in unexpected behavior.
|
|
28403
|
-
|
|
28270
|
+
For example, booting the instance in the full browser environment
|
|
28404
28271
|
while specifying a foreign `document` object (e.g. `{ isBrowser: true,
|
|
28405
28272
|
document: iframe.contentDocument }`) does not work correctly today,
|
|
28406
28273
|
largely due to Ember's jQuery dependency.
|
|
28407
|
-
|
|
28274
|
+
Currently, there are three officially supported scenarios/configurations.
|
|
28408
28275
|
Usages outside of these scenarios are not guaranteed to work, but please
|
|
28409
28276
|
feel free to file bug reports documenting your experience and any issues
|
|
28410
28277
|
you encountered to help expand support.
|
|
28411
|
-
|
|
28412
|
-
|
|
28278
|
+
#### Browser Applications (Manual Boot)
|
|
28279
|
+
The setup is largely similar to how Ember works out-of-the-box. Normally,
|
|
28413
28280
|
Ember will boot a default instance for your Application on "DOM ready".
|
|
28414
28281
|
However, you can customize this behavior by disabling `autoboot`.
|
|
28415
|
-
|
|
28282
|
+
For example, this allows you to render a miniture demo of your application
|
|
28416
28283
|
into a specific area on your marketing website:
|
|
28417
|
-
|
|
28284
|
+
```javascript
|
|
28418
28285
|
import MyApp from 'my-app';
|
|
28419
|
-
|
|
28286
|
+
$(function() {
|
|
28420
28287
|
let App = MyApp.create({ autoboot: false });
|
|
28421
|
-
|
|
28288
|
+
let options = {
|
|
28422
28289
|
// Override the router's location adapter to prevent it from updating
|
|
28423
28290
|
// the URL in the address bar
|
|
28424
28291
|
location: 'none',
|
|
28425
|
-
|
|
28292
|
+
// Override the default `rootElement` on the app to render into a
|
|
28426
28293
|
// specific `div` on the page
|
|
28427
28294
|
rootElement: '#demo'
|
|
28428
28295
|
};
|
|
28429
|
-
|
|
28296
|
+
// Start the app at the special demo URL
|
|
28430
28297
|
App.visit('/demo', options);
|
|
28431
28298
|
});
|
|
28432
28299
|
```
|
|
28433
|
-
|
|
28300
|
+
Or perhaps you might want to boot two instances of your app on the same
|
|
28434
28301
|
page for a split-screen multiplayer experience:
|
|
28435
|
-
|
|
28302
|
+
```javascript
|
|
28436
28303
|
import MyApp from 'my-app';
|
|
28437
|
-
|
|
28304
|
+
$(function() {
|
|
28438
28305
|
let App = MyApp.create({ autoboot: false });
|
|
28439
|
-
|
|
28440
|
-
|
|
28306
|
+
let sessionId = MyApp.generateSessionID();
|
|
28307
|
+
let player1 = App.visit(`/matches/join?name=Player+1&session=${sessionId}`, { rootElement: '#left', location: 'none' });
|
|
28441
28308
|
let player2 = App.visit(`/matches/join?name=Player+2&session=${sessionId}`, { rootElement: '#right', location: 'none' });
|
|
28442
|
-
|
|
28309
|
+
Promise.all([player1, player2]).then(() => {
|
|
28443
28310
|
// Both apps have completed the initial render
|
|
28444
28311
|
$('#loading').fadeOut();
|
|
28445
28312
|
});
|
|
28446
28313
|
});
|
|
28447
28314
|
```
|
|
28448
|
-
|
|
28315
|
+
Do note that each app instance maintains their own registry/container, so
|
|
28449
28316
|
they will run in complete isolation by default.
|
|
28450
|
-
|
|
28451
|
-
|
|
28317
|
+
#### Server-Side Rendering (also known as FastBoot)
|
|
28318
|
+
This setup allows you to run your Ember app in a server environment using
|
|
28452
28319
|
Node.js and render its content into static HTML for SEO purposes.
|
|
28453
|
-
|
|
28320
|
+
```javascript
|
|
28454
28321
|
const HTMLSerializer = new SimpleDOM.HTMLSerializer(SimpleDOM.voidMap);
|
|
28455
|
-
|
|
28322
|
+
function renderURL(url) {
|
|
28456
28323
|
let dom = new SimpleDOM.Document();
|
|
28457
28324
|
let rootElement = dom.body;
|
|
28458
28325
|
let options = { isBrowser: false, document: dom, rootElement: rootElement };
|
|
28459
|
-
|
|
28326
|
+
return MyApp.visit(options).then(instance => {
|
|
28460
28327
|
try {
|
|
28461
28328
|
return HTMLSerializer.serialize(rootElement.firstChild);
|
|
28462
28329
|
} finally {
|
|
@@ -28465,50 +28332,50 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28465
28332
|
});
|
|
28466
28333
|
}
|
|
28467
28334
|
```
|
|
28468
|
-
|
|
28335
|
+
In this scenario, because Ember does not have access to a global `document`
|
|
28469
28336
|
object in the Node.js environment, you must provide one explicitly. In practice,
|
|
28470
28337
|
in the non-browser environment, the stand-in `document` object only needs to
|
|
28471
28338
|
implement a limited subset of the full DOM API. The `SimpleDOM` library is known
|
|
28472
28339
|
to work.
|
|
28473
|
-
|
|
28340
|
+
Since there is no DOM access in the non-browser environment, you must also
|
|
28474
28341
|
specify a DOM `Element` object in the same `document` for the `rootElement` option
|
|
28475
28342
|
(as opposed to a selector string like `"body"`).
|
|
28476
|
-
|
|
28343
|
+
See the documentation on the `isBrowser`, `document` and `rootElement` properties
|
|
28477
28344
|
on `ApplicationInstance.BootOptions` for details.
|
|
28478
|
-
|
|
28479
|
-
|
|
28345
|
+
#### Server-Side Resource Discovery
|
|
28346
|
+
This setup allows you to run the routing layer of your Ember app in a server
|
|
28480
28347
|
environment using Node.js and completely disable rendering. This allows you
|
|
28481
28348
|
to simulate and discover the resources (i.e. AJAX requests) needed to fulfill
|
|
28482
28349
|
a given request and eagerly "push" these resources to the client.
|
|
28483
|
-
|
|
28350
|
+
```app/initializers/network-service.js
|
|
28484
28351
|
import BrowserNetworkService from 'app/services/network/browser';
|
|
28485
28352
|
import NodeNetworkService from 'app/services/network/node';
|
|
28486
|
-
|
|
28353
|
+
// Inject a (hypothetical) service for abstracting all AJAX calls and use
|
|
28487
28354
|
// the appropriate implementation on the client/server. This also allows the
|
|
28488
28355
|
// server to log all the AJAX calls made during a particular request and use
|
|
28489
28356
|
// that for resource-discovery purpose.
|
|
28490
|
-
|
|
28357
|
+
export function initialize(application) {
|
|
28491
28358
|
if (window) { // browser
|
|
28492
28359
|
application.register('service:network', BrowserNetworkService);
|
|
28493
28360
|
} else { // node
|
|
28494
28361
|
application.register('service:network', NodeNetworkService);
|
|
28495
28362
|
}
|
|
28496
28363
|
};
|
|
28497
|
-
|
|
28364
|
+
export default {
|
|
28498
28365
|
name: 'network-service',
|
|
28499
28366
|
initialize: initialize
|
|
28500
28367
|
};
|
|
28501
28368
|
```
|
|
28502
|
-
|
|
28369
|
+
```app/routes/post.js
|
|
28503
28370
|
import Route from '@ember/routing/route';
|
|
28504
28371
|
import { service } from '@ember/service';
|
|
28505
|
-
|
|
28506
|
-
|
|
28372
|
+
// An example of how the (hypothetical) service is used in routes.
|
|
28373
|
+
export default class IndexRoute extends Route {
|
|
28507
28374
|
@service network;
|
|
28508
|
-
|
|
28375
|
+
model(params) {
|
|
28509
28376
|
return this.network.fetch(`/api/posts/${params.post_id}.json`);
|
|
28510
28377
|
}
|
|
28511
|
-
|
|
28378
|
+
afterModel(post) {
|
|
28512
28379
|
if (post.isExternalContent) {
|
|
28513
28380
|
return this.network.fetch(`/api/external/?url=${post.externalURL}`);
|
|
28514
28381
|
} else {
|
|
@@ -28517,21 +28384,23 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28517
28384
|
}
|
|
28518
28385
|
}
|
|
28519
28386
|
```
|
|
28520
|
-
|
|
28387
|
+
```javascript
|
|
28521
28388
|
// Finally, put all the pieces together
|
|
28522
|
-
|
|
28389
|
+
function discoverResourcesFor(url) {
|
|
28523
28390
|
return MyApp.visit(url, { isBrowser: false, shouldRender: false }).then(instance => {
|
|
28524
28391
|
let networkService = instance.lookup('service:network');
|
|
28525
28392
|
return networkService.requests; // => { "/api/posts/123.json": "..." }
|
|
28526
28393
|
});
|
|
28527
28394
|
}
|
|
28528
28395
|
```
|
|
28529
|
-
|
|
28396
|
+
@public
|
|
28530
28397
|
@method visit
|
|
28531
28398
|
@param url {String} The initial URL to navigate to
|
|
28532
28399
|
@param options {ApplicationInstance.BootOptions}
|
|
28533
28400
|
@return {Promise<ApplicationInstance, Error>}
|
|
28534
28401
|
*/
|
|
28402
|
+
|
|
28403
|
+
|
|
28535
28404
|
visit(url, options) {
|
|
28536
28405
|
(true && !(!this.isDestroyed) && (0, _debug.assert)('You cannot visit this application since it has already been destroyed', !this.isDestroyed));
|
|
28537
28406
|
(true && !(!this.isDestroying) && (0, _debug.assert)('You cannot visit this application since it is being destroyed', !this.isDestroying));
|
|
@@ -28544,40 +28413,7 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28544
28413
|
});
|
|
28545
28414
|
}
|
|
28546
28415
|
|
|
28547
|
-
}
|
|
28548
|
-
|
|
28549
|
-
Application.reopenClass({
|
|
28550
|
-
/**
|
|
28551
|
-
This creates a registry with the default Ember naming conventions.
|
|
28552
|
-
It also configures the registry:
|
|
28553
|
-
* registered views are created every time they are looked up (they are
|
|
28554
|
-
not singletons)
|
|
28555
|
-
* registered templates are not factories; the registered value is
|
|
28556
|
-
returned directly.
|
|
28557
|
-
* the router receives the application as its `namespace` property
|
|
28558
|
-
* all controllers receive the router as their `target` and `controllers`
|
|
28559
|
-
properties
|
|
28560
|
-
* all controllers receive the application as their `namespace` property
|
|
28561
|
-
* the application view receives the application controller as its
|
|
28562
|
-
`controller` property
|
|
28563
|
-
* the application view receives the application template as its
|
|
28564
|
-
`defaultTemplate` property
|
|
28565
|
-
@method buildRegistry
|
|
28566
|
-
@static
|
|
28567
|
-
@param {Application} namespace the application for which to
|
|
28568
|
-
build the registry
|
|
28569
|
-
@return {Ember.Registry} the built registry
|
|
28570
|
-
@private
|
|
28571
|
-
*/
|
|
28572
|
-
buildRegistry() {
|
|
28573
|
-
var registry = this._super(...arguments);
|
|
28574
|
-
|
|
28575
|
-
commonSetupRegistry(registry);
|
|
28576
|
-
(0, _glimmer.setupApplicationRegistry)(registry);
|
|
28577
|
-
return registry;
|
|
28578
|
-
}
|
|
28579
|
-
|
|
28580
|
-
});
|
|
28416
|
+
}
|
|
28581
28417
|
|
|
28582
28418
|
function commonSetupRegistry(registry) {
|
|
28583
28419
|
registry.register('router:main', _routing.Router);
|
|
@@ -28649,9 +28485,11 @@ define("@ember/application/lib/lazy_load", ["exports", "@ember/-internals/enviro
|
|
|
28649
28485
|
_exports._loaded = _loaded;
|
|
28650
28486
|
|
|
28651
28487
|
function onLoad(name, callback) {
|
|
28488
|
+
var _a;
|
|
28489
|
+
|
|
28652
28490
|
var object = loaded[name];
|
|
28653
|
-
loadHooks[name]
|
|
28654
|
-
|
|
28491
|
+
var hooks = (_a = loadHooks[name]) !== null && _a !== void 0 ? _a : loadHooks[name] = [];
|
|
28492
|
+
hooks.push(callback);
|
|
28655
28493
|
|
|
28656
28494
|
if (object) {
|
|
28657
28495
|
callback(object);
|
|
@@ -28671,20 +28509,19 @@ define("@ember/application/lib/lazy_load", ["exports", "@ember/-internals/enviro
|
|
|
28671
28509
|
|
|
28672
28510
|
|
|
28673
28511
|
function runLoadHooks(name, object) {
|
|
28512
|
+
var _a;
|
|
28513
|
+
|
|
28674
28514
|
loaded[name] = object;
|
|
28675
28515
|
|
|
28676
28516
|
if (_browserEnvironment.window && typeof CustomEvent === 'function') {
|
|
28677
28517
|
var event = new CustomEvent(name, {
|
|
28678
|
-
detail: object
|
|
28679
|
-
name
|
|
28518
|
+
detail: object
|
|
28680
28519
|
});
|
|
28681
28520
|
|
|
28682
28521
|
_browserEnvironment.window.dispatchEvent(event);
|
|
28683
28522
|
}
|
|
28684
28523
|
|
|
28685
|
-
|
|
28686
|
-
loadHooks[name].forEach(callback => callback(object));
|
|
28687
|
-
}
|
|
28524
|
+
(_a = loadHooks[name]) === null || _a === void 0 ? void 0 : _a.forEach(callback => callback(object));
|
|
28688
28525
|
}
|
|
28689
28526
|
});
|
|
28690
28527
|
define("@ember/application/namespace", ["exports", "@ember/-internals/runtime"], function (_exports, _runtime) {
|
|
@@ -30070,7 +29907,7 @@ define("@ember/destroyable/index", ["exports", "@glimmer/destroyable"], function
|
|
|
30070
29907
|
return (0, _destroyable.unregisterDestructor)(destroyable, destructor);
|
|
30071
29908
|
}
|
|
30072
29909
|
});
|
|
30073
|
-
define("@ember/engine/index", ["exports", "@ember/engine/lib/engine-parent", "@ember/-internals/utils", "@ember/controller", "@ember/-internals/runtime", "@ember/-internals/container", "dag-map", "@ember/debug", "@ember/-internals/metal", "@ember/engine/instance", "@ember/-internals/routing", "@ember/-internals/extension-support", "@ember/-internals/views", "@ember/-internals/glimmer"], function (_exports, _engineParent, _utils, _controller, _runtime, _container, _dagMap, _debug, _metal, _instance, _routing, _extensionSupport, _views, _glimmer) {
|
|
29910
|
+
define("@ember/engine/index", ["exports", "@ember/engine/lib/engine-parent", "@ember/-internals/utils", "@ember/controller", "@ember/-internals/runtime", "@ember/-internals/container", "dag-map", "@ember/debug", "@ember/-internals/metal", "@ember/engine/instance", "@ember/-internals/routing", "@ember/-internals/extension-support", "@ember/-internals/views", "@ember/-internals/glimmer", "@ember/-internals/runtime/lib/mixins/registry_proxy"], function (_exports, _engineParent, _utils, _controller, _runtime, _container, _dagMap, _debug, _metal, _instance, _routing, _extensionSupport, _views, _glimmer, _registry_proxy) {
|
|
30074
29911
|
"use strict";
|
|
30075
29912
|
|
|
30076
29913
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -30099,119 +29936,145 @@ define("@ember/engine/index", ["exports", "@ember/engine/lib/engine-parent", "@e
|
|
|
30099
29936
|
|
|
30100
29937
|
return properties;
|
|
30101
29938
|
}
|
|
30102
|
-
/**
|
|
30103
|
-
@module @ember/engine
|
|
30104
|
-
*/
|
|
30105
|
-
|
|
30106
|
-
/**
|
|
30107
|
-
The `Engine` class contains core functionality for both applications and
|
|
30108
|
-
engines.
|
|
30109
|
-
|
|
30110
|
-
Each engine manages a registry that's used for dependency injection and
|
|
30111
|
-
exposed through `RegistryProxy`.
|
|
30112
|
-
|
|
30113
|
-
Engines also manage initializers and instance initializers.
|
|
30114
|
-
|
|
30115
|
-
Engines can spawn `EngineInstance` instances via `buildInstance()`.
|
|
30116
|
-
|
|
30117
|
-
@class Engine
|
|
30118
|
-
@extends Ember.Namespace
|
|
30119
|
-
@uses RegistryProxy
|
|
30120
|
-
@public
|
|
30121
|
-
*/
|
|
30122
29939
|
|
|
29940
|
+
class Engine extends _runtime.Namespace.extend(_registry_proxy.default) {
|
|
29941
|
+
constructor() {
|
|
29942
|
+
super(...arguments);
|
|
29943
|
+
/**
|
|
29944
|
+
A private flag indicating whether an engine's initializers have run yet.
|
|
29945
|
+
@private
|
|
29946
|
+
@property _initializersRan
|
|
29947
|
+
*/
|
|
30123
29948
|
|
|
30124
|
-
|
|
30125
|
-
|
|
30126
|
-
this._super(...arguments);
|
|
30127
|
-
|
|
30128
|
-
this.buildRegistry();
|
|
30129
|
-
},
|
|
30130
|
-
|
|
29949
|
+
this._initializersRan = false;
|
|
29950
|
+
}
|
|
30131
29951
|
/**
|
|
30132
|
-
|
|
30133
|
-
|
|
30134
|
-
|
|
29952
|
+
This creates a registry with the default Ember naming conventions.
|
|
29953
|
+
It also configures the registry:
|
|
29954
|
+
* registered views are created every time they are looked up (they are
|
|
29955
|
+
not singletons)
|
|
29956
|
+
* registered templates are not factories; the registered value is
|
|
29957
|
+
returned directly.
|
|
29958
|
+
* the router receives the application as its `namespace` property
|
|
29959
|
+
* all controllers receive the router as their `target` and `controllers`
|
|
29960
|
+
properties
|
|
29961
|
+
* all controllers receive the application as their `namespace` property
|
|
29962
|
+
* the application view receives the application controller as its
|
|
29963
|
+
`controller` property
|
|
29964
|
+
* the application view receives the application template as its
|
|
29965
|
+
`defaultTemplate` property
|
|
29966
|
+
@method buildRegistry
|
|
29967
|
+
@static
|
|
29968
|
+
@param {Application} namespace the application for which to
|
|
29969
|
+
build the registry
|
|
29970
|
+
@return {Ember.Registry} the built registry
|
|
29971
|
+
@private
|
|
30135
29972
|
*/
|
|
30136
|
-
_initializersRan: false,
|
|
30137
29973
|
|
|
29974
|
+
|
|
29975
|
+
static buildRegistry(namespace) {
|
|
29976
|
+
var registry = new _container.Registry({
|
|
29977
|
+
resolver: resolverFor(namespace)
|
|
29978
|
+
});
|
|
29979
|
+
registry.set = _metal.set;
|
|
29980
|
+
registry.register('application:main', namespace, {
|
|
29981
|
+
instantiate: false
|
|
29982
|
+
});
|
|
29983
|
+
commonSetupRegistry(registry);
|
|
29984
|
+
(0, _glimmer.setupEngineRegistry)(registry);
|
|
29985
|
+
return registry;
|
|
29986
|
+
}
|
|
29987
|
+
|
|
29988
|
+
init(properties) {
|
|
29989
|
+
super.init(properties);
|
|
29990
|
+
this.buildRegistry();
|
|
29991
|
+
}
|
|
30138
29992
|
/**
|
|
30139
29993
|
Ensure that initializers are run once, and only once, per engine.
|
|
30140
|
-
|
|
29994
|
+
@private
|
|
30141
29995
|
@method ensureInitializers
|
|
30142
29996
|
*/
|
|
29997
|
+
|
|
29998
|
+
|
|
30143
29999
|
ensureInitializers() {
|
|
30144
30000
|
if (!this._initializersRan) {
|
|
30145
30001
|
this.runInitializers();
|
|
30146
30002
|
this._initializersRan = true;
|
|
30147
30003
|
}
|
|
30148
|
-
}
|
|
30149
|
-
|
|
30004
|
+
}
|
|
30150
30005
|
/**
|
|
30151
30006
|
Create an EngineInstance for this engine.
|
|
30152
|
-
|
|
30007
|
+
@public
|
|
30153
30008
|
@method buildInstance
|
|
30154
30009
|
@return {EngineInstance} the engine instance
|
|
30155
30010
|
*/
|
|
30011
|
+
|
|
30012
|
+
|
|
30156
30013
|
buildInstance(options) {
|
|
30157
30014
|
if (options === void 0) {
|
|
30158
30015
|
options = {};
|
|
30159
30016
|
}
|
|
30160
30017
|
|
|
30161
30018
|
this.ensureInitializers();
|
|
30162
|
-
|
|
30163
|
-
|
|
30164
|
-
|
|
30165
|
-
|
|
30019
|
+
return _instance.default.create(Object.assign(Object.assign({}, options), {
|
|
30020
|
+
base: this
|
|
30021
|
+
}));
|
|
30022
|
+
}
|
|
30166
30023
|
/**
|
|
30167
30024
|
Build and configure the registry for the current engine.
|
|
30168
|
-
|
|
30025
|
+
@private
|
|
30169
30026
|
@method buildRegistry
|
|
30170
30027
|
@return {Ember.Registry} the configured registry
|
|
30171
30028
|
*/
|
|
30029
|
+
|
|
30030
|
+
|
|
30172
30031
|
buildRegistry() {
|
|
30173
30032
|
var registry = this.__registry__ = this.constructor.buildRegistry(this);
|
|
30174
30033
|
return registry;
|
|
30175
|
-
}
|
|
30176
|
-
|
|
30034
|
+
}
|
|
30177
30035
|
/**
|
|
30178
30036
|
@private
|
|
30179
30037
|
@method initializer
|
|
30180
30038
|
*/
|
|
30181
|
-
initializer(options) {
|
|
30182
|
-
this.constructor.initializer(options);
|
|
30183
|
-
},
|
|
30184
30039
|
|
|
30040
|
+
|
|
30041
|
+
initializer(initializer) {
|
|
30042
|
+
this.constructor.initializer(initializer);
|
|
30043
|
+
}
|
|
30185
30044
|
/**
|
|
30186
30045
|
@private
|
|
30187
30046
|
@method instanceInitializer
|
|
30188
30047
|
*/
|
|
30189
|
-
instanceInitializer(options) {
|
|
30190
|
-
this.constructor.instanceInitializer(options);
|
|
30191
|
-
},
|
|
30192
30048
|
|
|
30049
|
+
|
|
30050
|
+
instanceInitializer(initializer) {
|
|
30051
|
+
this.constructor.instanceInitializer(initializer);
|
|
30052
|
+
}
|
|
30193
30053
|
/**
|
|
30194
30054
|
@private
|
|
30195
30055
|
@method runInitializers
|
|
30196
30056
|
*/
|
|
30057
|
+
|
|
30058
|
+
|
|
30197
30059
|
runInitializers() {
|
|
30198
30060
|
this._runInitializer('initializers', (name, initializer) => {
|
|
30199
|
-
(true && !(
|
|
30061
|
+
(true && !(initializer) && (0, _debug.assert)(`No application initializer named '${name}'`, initializer));
|
|
30200
30062
|
initializer.initialize(this);
|
|
30201
30063
|
});
|
|
30202
|
-
}
|
|
30203
|
-
|
|
30064
|
+
}
|
|
30204
30065
|
/**
|
|
30205
30066
|
@private
|
|
30206
30067
|
@since 1.12.0
|
|
30207
30068
|
@method runInstanceInitializers
|
|
30208
30069
|
*/
|
|
30070
|
+
|
|
30071
|
+
|
|
30209
30072
|
runInstanceInitializers(instance) {
|
|
30210
30073
|
this._runInitializer('instanceInitializers', (name, initializer) => {
|
|
30211
|
-
(true && !(
|
|
30074
|
+
(true && !(initializer) && (0, _debug.assert)(`No instance initializer named '${name}'`, initializer));
|
|
30212
30075
|
initializer.initialize(instance);
|
|
30213
30076
|
});
|
|
30214
|
-
}
|
|
30077
|
+
}
|
|
30215
30078
|
|
|
30216
30079
|
_runInitializer(bucketName, cb) {
|
|
30217
30080
|
var initializersByName = (0, _metal.get)(this.constructor, bucketName);
|
|
@@ -30219,233 +30082,238 @@ define("@ember/engine/index", ["exports", "@ember/engine/lib/engine-parent", "@e
|
|
|
30219
30082
|
var graph = new _dagMap.default();
|
|
30220
30083
|
var initializer;
|
|
30221
30084
|
|
|
30222
|
-
for (var
|
|
30223
|
-
initializer = initializersByName[
|
|
30085
|
+
for (var name of initializers) {
|
|
30086
|
+
initializer = initializersByName[name];
|
|
30087
|
+
(true && !(initializer) && (0, _debug.assert)(`missing ${bucketName}: ${name}`, initializer));
|
|
30224
30088
|
graph.add(initializer.name, initializer, initializer.before, initializer.after);
|
|
30225
30089
|
}
|
|
30226
30090
|
|
|
30227
30091
|
graph.topsort(cb);
|
|
30228
30092
|
}
|
|
30229
30093
|
|
|
30230
|
-
}
|
|
30231
|
-
|
|
30232
|
-
Engine.reopenClass({
|
|
30233
|
-
initializers: Object.create(null),
|
|
30234
|
-
instanceInitializers: Object.create(null),
|
|
30235
|
-
|
|
30236
|
-
/**
|
|
30237
|
-
The goal of initializers should be to register dependencies and injections.
|
|
30238
|
-
This phase runs once. Because these initializers may load code, they are
|
|
30239
|
-
allowed to defer application readiness and advance it. If you need to access
|
|
30240
|
-
the container or store you should use an InstanceInitializer that will be run
|
|
30241
|
-
after all initializers and therefore after all code is loaded and the app is
|
|
30242
|
-
ready.
|
|
30243
|
-
Initializer receives an object which has the following attributes:
|
|
30244
|
-
`name`, `before`, `after`, `initialize`. The only required attribute is
|
|
30245
|
-
`initialize`, all others are optional.
|
|
30246
|
-
* `name` allows you to specify under which name the initializer is registered.
|
|
30247
|
-
This must be a unique name, as trying to register two initializers with the
|
|
30248
|
-
same name will result in an error.
|
|
30249
|
-
```app/initializer/named-initializer.js
|
|
30250
|
-
import { debug } from '@ember/debug';
|
|
30251
|
-
export function initialize() {
|
|
30252
|
-
debug('Running namedInitializer!');
|
|
30253
|
-
}
|
|
30254
|
-
export default {
|
|
30255
|
-
name: 'named-initializer',
|
|
30256
|
-
initialize
|
|
30257
|
-
};
|
|
30258
|
-
```
|
|
30259
|
-
* `before` and `after` are used to ensure that this initializer is ran prior
|
|
30260
|
-
or after the one identified by the value. This value can be a single string
|
|
30261
|
-
or an array of strings, referencing the `name` of other initializers.
|
|
30262
|
-
An example of ordering initializers, we create an initializer named `first`:
|
|
30263
|
-
```app/initializer/first.js
|
|
30264
|
-
import { debug } from '@ember/debug';
|
|
30265
|
-
export function initialize() {
|
|
30266
|
-
debug('First initializer!');
|
|
30267
|
-
}
|
|
30268
|
-
export default {
|
|
30269
|
-
name: 'first',
|
|
30270
|
-
initialize
|
|
30271
|
-
};
|
|
30272
|
-
```
|
|
30273
|
-
```bash
|
|
30274
|
-
// DEBUG: First initializer!
|
|
30275
|
-
```
|
|
30276
|
-
We add another initializer named `second`, specifying that it should run
|
|
30277
|
-
after the initializer named `first`:
|
|
30278
|
-
```app/initializer/second.js
|
|
30279
|
-
import { debug } from '@ember/debug';
|
|
30280
|
-
export function initialize() {
|
|
30281
|
-
debug('Second initializer!');
|
|
30282
|
-
}
|
|
30283
|
-
export default {
|
|
30284
|
-
name: 'second',
|
|
30285
|
-
after: 'first',
|
|
30286
|
-
initialize
|
|
30287
|
-
};
|
|
30288
|
-
```
|
|
30289
|
-
```
|
|
30290
|
-
// DEBUG: First initializer!
|
|
30291
|
-
// DEBUG: Second initializer!
|
|
30292
|
-
```
|
|
30293
|
-
Afterwards we add a further initializer named `pre`, this time specifying
|
|
30294
|
-
that it should run before the initializer named `first`:
|
|
30295
|
-
```app/initializer/pre.js
|
|
30296
|
-
import { debug } from '@ember/debug';
|
|
30297
|
-
export function initialize() {
|
|
30298
|
-
debug('Pre initializer!');
|
|
30299
|
-
}
|
|
30300
|
-
export default {
|
|
30301
|
-
name: 'pre',
|
|
30302
|
-
before: 'first',
|
|
30303
|
-
initialize
|
|
30304
|
-
};
|
|
30305
|
-
```
|
|
30306
|
-
```bash
|
|
30307
|
-
// DEBUG: Pre initializer!
|
|
30308
|
-
// DEBUG: First initializer!
|
|
30309
|
-
// DEBUG: Second initializer!
|
|
30310
|
-
```
|
|
30311
|
-
Finally we add an initializer named `post`, specifying it should run after
|
|
30312
|
-
both the `first` and the `second` initializers:
|
|
30313
|
-
```app/initializer/post.js
|
|
30314
|
-
import { debug } from '@ember/debug';
|
|
30315
|
-
export function initialize() {
|
|
30316
|
-
debug('Post initializer!');
|
|
30317
|
-
}
|
|
30318
|
-
export default {
|
|
30319
|
-
name: 'post',
|
|
30320
|
-
after: ['first', 'second'],
|
|
30321
|
-
initialize
|
|
30322
|
-
};
|
|
30323
|
-
```
|
|
30324
|
-
```bash
|
|
30325
|
-
// DEBUG: Pre initializer!
|
|
30326
|
-
// DEBUG: First initializer!
|
|
30327
|
-
// DEBUG: Second initializer!
|
|
30328
|
-
// DEBUG: Post initializer!
|
|
30329
|
-
```
|
|
30330
|
-
* `initialize` is a callback function that receives one argument,
|
|
30331
|
-
`application`, on which you can operate.
|
|
30332
|
-
Example of using `application` to register an adapter:
|
|
30333
|
-
```app/initializer/api-adapter.js
|
|
30334
|
-
import ApiAdapter from '../utils/api-adapter';
|
|
30335
|
-
export function initialize(application) {
|
|
30336
|
-
application.register('api-adapter:main', ApiAdapter);
|
|
30337
|
-
}
|
|
30338
|
-
export default {
|
|
30339
|
-
name: 'post',
|
|
30340
|
-
after: ['first', 'second'],
|
|
30341
|
-
initialize
|
|
30342
|
-
};
|
|
30343
|
-
```
|
|
30344
|
-
@method initializer
|
|
30345
|
-
@param initializer {Object}
|
|
30346
|
-
@public
|
|
30347
|
-
*/
|
|
30348
|
-
initializer: buildInitializerMethod('initializers', 'initializer'),
|
|
30094
|
+
}
|
|
30349
30095
|
|
|
30350
|
-
|
|
30351
|
-
|
|
30352
|
-
|
|
30353
|
-
|
|
30354
|
-
|
|
30355
|
-
|
|
30356
|
-
|
|
30357
|
-
|
|
30358
|
-
|
|
30359
|
-
|
|
30360
|
-
|
|
30361
|
-
|
|
30362
|
-
|
|
30363
|
-
|
|
30364
|
-
|
|
30365
|
-
|
|
30366
|
-
|
|
30367
|
-
|
|
30368
|
-
|
|
30369
|
-
|
|
30370
|
-
|
|
30371
|
-
|
|
30372
|
-
|
|
30373
|
-
|
|
30374
|
-
|
|
30375
|
-
|
|
30376
|
-
|
|
30377
|
-
|
|
30378
|
-
|
|
30379
|
-
|
|
30380
|
-
|
|
30381
|
-
|
|
30382
|
-
|
|
30383
|
-
|
|
30384
|
-
|
|
30385
|
-
|
|
30386
|
-
|
|
30387
|
-
|
|
30388
|
-
|
|
30389
|
-
|
|
30390
|
-
|
|
30391
|
-
|
|
30392
|
-
|
|
30393
|
-
|
|
30394
|
-
|
|
30395
|
-
|
|
30396
|
-
|
|
30397
|
-
|
|
30398
|
-
|
|
30399
|
-
|
|
30400
|
-
|
|
30401
|
-
|
|
30402
|
-
|
|
30403
|
-
|
|
30404
|
-
|
|
30405
|
-
|
|
30096
|
+
Engine.initializers = Object.create(null);
|
|
30097
|
+
Engine.instanceInitializers = Object.create(null);
|
|
30098
|
+
/**
|
|
30099
|
+
The goal of initializers should be to register dependencies and injections.
|
|
30100
|
+
This phase runs once. Because these initializers may load code, they are
|
|
30101
|
+
allowed to defer application readiness and advance it. If you need to access
|
|
30102
|
+
the container or store you should use an InstanceInitializer that will be run
|
|
30103
|
+
after all initializers and therefore after all code is loaded and the app is
|
|
30104
|
+
ready.
|
|
30105
|
+
|
|
30106
|
+
Initializer receives an object which has the following attributes:
|
|
30107
|
+
`name`, `before`, `after`, `initialize`. The only required attribute is
|
|
30108
|
+
`initialize`, all others are optional.
|
|
30109
|
+
|
|
30110
|
+
* `name` allows you to specify under which name the initializer is registered.
|
|
30111
|
+
This must be a unique name, as trying to register two initializers with the
|
|
30112
|
+
same name will result in an error.
|
|
30113
|
+
|
|
30114
|
+
```app/initializer/named-initializer.js
|
|
30115
|
+
import { debug } from '@ember/debug';
|
|
30116
|
+
|
|
30117
|
+
export function initialize() {
|
|
30118
|
+
debug('Running namedInitializer!');
|
|
30119
|
+
}
|
|
30120
|
+
|
|
30121
|
+
export default {
|
|
30122
|
+
name: 'named-initializer',
|
|
30123
|
+
initialize
|
|
30124
|
+
};
|
|
30125
|
+
```
|
|
30126
|
+
|
|
30127
|
+
* `before` and `after` are used to ensure that this initializer is ran prior
|
|
30128
|
+
or after the one identified by the value. This value can be a single string
|
|
30129
|
+
or an array of strings, referencing the `name` of other initializers.
|
|
30130
|
+
|
|
30131
|
+
An example of ordering initializers, we create an initializer named `first`:
|
|
30132
|
+
|
|
30133
|
+
```app/initializer/first.js
|
|
30134
|
+
import { debug } from '@ember/debug';
|
|
30135
|
+
|
|
30136
|
+
export function initialize() {
|
|
30137
|
+
debug('First initializer!');
|
|
30138
|
+
}
|
|
30139
|
+
|
|
30140
|
+
export default {
|
|
30141
|
+
name: 'first',
|
|
30142
|
+
initialize
|
|
30143
|
+
};
|
|
30144
|
+
```
|
|
30145
|
+
|
|
30146
|
+
```bash
|
|
30147
|
+
// DEBUG: First initializer!
|
|
30148
|
+
```
|
|
30149
|
+
|
|
30150
|
+
We add another initializer named `second`, specifying that it should run
|
|
30151
|
+
after the initializer named `first`:
|
|
30152
|
+
|
|
30153
|
+
```app/initializer/second.js
|
|
30154
|
+
import { debug } from '@ember/debug';
|
|
30155
|
+
|
|
30156
|
+
export function initialize() {
|
|
30157
|
+
debug('Second initializer!');
|
|
30158
|
+
}
|
|
30159
|
+
|
|
30160
|
+
export default {
|
|
30161
|
+
name: 'second',
|
|
30162
|
+
after: 'first',
|
|
30163
|
+
initialize
|
|
30164
|
+
};
|
|
30165
|
+
```
|
|
30166
|
+
|
|
30167
|
+
```
|
|
30168
|
+
// DEBUG: First initializer!
|
|
30169
|
+
// DEBUG: Second initializer!
|
|
30170
|
+
```
|
|
30171
|
+
|
|
30172
|
+
Afterwards we add a further initializer named `pre`, this time specifying
|
|
30173
|
+
that it should run before the initializer named `first`:
|
|
30174
|
+
|
|
30175
|
+
```app/initializer/pre.js
|
|
30176
|
+
import { debug } from '@ember/debug';
|
|
30177
|
+
|
|
30178
|
+
export function initialize() {
|
|
30179
|
+
debug('Pre initializer!');
|
|
30180
|
+
}
|
|
30181
|
+
|
|
30182
|
+
export default {
|
|
30183
|
+
name: 'pre',
|
|
30184
|
+
before: 'first',
|
|
30185
|
+
initialize
|
|
30186
|
+
};
|
|
30187
|
+
```
|
|
30188
|
+
|
|
30189
|
+
```bash
|
|
30190
|
+
// DEBUG: Pre initializer!
|
|
30191
|
+
// DEBUG: First initializer!
|
|
30192
|
+
// DEBUG: Second initializer!
|
|
30193
|
+
```
|
|
30194
|
+
|
|
30195
|
+
Finally we add an initializer named `post`, specifying it should run after
|
|
30196
|
+
both the `first` and the `second` initializers:
|
|
30197
|
+
|
|
30198
|
+
```app/initializer/post.js
|
|
30199
|
+
import { debug } from '@ember/debug';
|
|
30200
|
+
|
|
30201
|
+
export function initialize() {
|
|
30202
|
+
debug('Post initializer!');
|
|
30203
|
+
}
|
|
30204
|
+
|
|
30205
|
+
export default {
|
|
30206
|
+
name: 'post',
|
|
30207
|
+
after: ['first', 'second'],
|
|
30208
|
+
initialize
|
|
30209
|
+
};
|
|
30210
|
+
```
|
|
30211
|
+
|
|
30212
|
+
```bash
|
|
30213
|
+
// DEBUG: Pre initializer!
|
|
30214
|
+
// DEBUG: First initializer!
|
|
30215
|
+
// DEBUG: Second initializer!
|
|
30216
|
+
// DEBUG: Post initializer!
|
|
30217
|
+
```
|
|
30218
|
+
|
|
30219
|
+
* `initialize` is a callback function that receives one argument,
|
|
30220
|
+
`application`, on which you can operate.
|
|
30221
|
+
|
|
30222
|
+
Example of using `application` to register an adapter:
|
|
30223
|
+
|
|
30224
|
+
```app/initializer/api-adapter.js
|
|
30225
|
+
import ApiAdapter from '../utils/api-adapter';
|
|
30226
|
+
|
|
30227
|
+
export function initialize(application) {
|
|
30228
|
+
application.register('api-adapter:main', ApiAdapter);
|
|
30229
|
+
}
|
|
30230
|
+
|
|
30231
|
+
export default {
|
|
30232
|
+
name: 'post',
|
|
30233
|
+
after: ['first', 'second'],
|
|
30234
|
+
initialize
|
|
30235
|
+
};
|
|
30236
|
+
```
|
|
30237
|
+
|
|
30238
|
+
@method initializer
|
|
30239
|
+
@param initializer {Object}
|
|
30240
|
+
@public
|
|
30241
|
+
*/
|
|
30406
30242
|
|
|
30407
|
-
|
|
30408
|
-
|
|
30409
|
-
|
|
30410
|
-
|
|
30411
|
-
|
|
30412
|
-
|
|
30413
|
-
|
|
30414
|
-
|
|
30415
|
-
|
|
30416
|
-
|
|
30417
|
-
|
|
30418
|
-
|
|
30419
|
-
|
|
30420
|
-
|
|
30421
|
-
|
|
30422
|
-
|
|
30423
|
-
|
|
30424
|
-
|
|
30425
|
-
|
|
30426
|
-
|
|
30427
|
-
|
|
30428
|
-
|
|
30429
|
-
|
|
30430
|
-
|
|
30431
|
-
|
|
30432
|
-
|
|
30433
|
-
|
|
30434
|
-
|
|
30435
|
-
|
|
30436
|
-
|
|
30437
|
-
|
|
30438
|
-
|
|
30439
|
-
|
|
30440
|
-
|
|
30243
|
+
Engine.initializer = buildInitializerMethod('initializers', 'initializer');
|
|
30244
|
+
/**
|
|
30245
|
+
Instance initializers run after all initializers have run. Because
|
|
30246
|
+
instance initializers run after the app is fully set up. We have access
|
|
30247
|
+
to the store, container, and other items. However, these initializers run
|
|
30248
|
+
after code has loaded and are not allowed to defer readiness.
|
|
30249
|
+
|
|
30250
|
+
Instance initializer receives an object which has the following attributes:
|
|
30251
|
+
`name`, `before`, `after`, `initialize`. The only required attribute is
|
|
30252
|
+
`initialize`, all others are optional.
|
|
30253
|
+
|
|
30254
|
+
* `name` allows you to specify under which name the instanceInitializer is
|
|
30255
|
+
registered. This must be a unique name, as trying to register two
|
|
30256
|
+
instanceInitializer with the same name will result in an error.
|
|
30257
|
+
|
|
30258
|
+
```app/initializer/named-instance-initializer.js
|
|
30259
|
+
import { debug } from '@ember/debug';
|
|
30260
|
+
|
|
30261
|
+
export function initialize() {
|
|
30262
|
+
debug('Running named-instance-initializer!');
|
|
30263
|
+
}
|
|
30264
|
+
|
|
30265
|
+
export default {
|
|
30266
|
+
name: 'named-instance-initializer',
|
|
30267
|
+
initialize
|
|
30268
|
+
};
|
|
30269
|
+
```
|
|
30270
|
+
|
|
30271
|
+
* `before` and `after` are used to ensure that this initializer is ran prior
|
|
30272
|
+
or after the one identified by the value. This value can be a single string
|
|
30273
|
+
or an array of strings, referencing the `name` of other initializers.
|
|
30274
|
+
|
|
30275
|
+
* See Application.initializer for discussion on the usage of before
|
|
30276
|
+
and after.
|
|
30277
|
+
|
|
30278
|
+
Example instanceInitializer to preload data into the store.
|
|
30279
|
+
|
|
30280
|
+
```app/initializer/preload-data.js
|
|
30281
|
+
|
|
30282
|
+
export function initialize(application) {
|
|
30283
|
+
var userConfig, userConfigEncoded, store;
|
|
30284
|
+
// We have a HTML escaped JSON representation of the user's basic
|
|
30285
|
+
// configuration generated server side and stored in the DOM of the main
|
|
30286
|
+
// index.html file. This allows the app to have access to a set of data
|
|
30287
|
+
// without making any additional remote calls. Good for basic data that is
|
|
30288
|
+
// needed for immediate rendering of the page. Keep in mind, this data,
|
|
30289
|
+
// like all local models and data can be manipulated by the user, so it
|
|
30290
|
+
// should not be relied upon for security or authorization.
|
|
30291
|
+
|
|
30292
|
+
// Grab the encoded data from the meta tag
|
|
30293
|
+
userConfigEncoded = document.querySelector('head meta[name=app-user-config]').attr('content');
|
|
30294
|
+
|
|
30295
|
+
// Unescape the text, then parse the resulting JSON into a real object
|
|
30296
|
+
userConfig = JSON.parse(unescape(userConfigEncoded));
|
|
30297
|
+
|
|
30298
|
+
// Lookup the store
|
|
30299
|
+
store = application.lookup('service:store');
|
|
30300
|
+
|
|
30301
|
+
// Push the encoded JSON into the store
|
|
30302
|
+
store.pushPayload(userConfig);
|
|
30303
|
+
}
|
|
30304
|
+
|
|
30305
|
+
export default {
|
|
30306
|
+
name: 'named-instance-initializer',
|
|
30307
|
+
initialize
|
|
30308
|
+
};
|
|
30309
|
+
```
|
|
30310
|
+
|
|
30311
|
+
@method instanceInitializer
|
|
30312
|
+
@param instanceInitializer
|
|
30313
|
+
@public
|
|
30314
|
+
*/
|
|
30441
30315
|
|
|
30442
|
-
|
|
30443
|
-
Set this to provide an alternate class to `DefaultResolver`
|
|
30444
|
-
@property resolver
|
|
30445
|
-
@public
|
|
30446
|
-
*/
|
|
30447
|
-
Resolver: null
|
|
30448
|
-
});
|
|
30316
|
+
Engine.instanceInitializer = buildInitializerMethod('instanceInitializers', 'instance initializer');
|
|
30449
30317
|
/**
|
|
30450
30318
|
This function defines the default lookup rules for container lookups:
|
|
30451
30319
|
|
|
@@ -30459,12 +30327,12 @@ define("@ember/engine/index", ["exports", "@ember/engine/lib/engine-parent", "@e
|
|
|
30459
30327
|
|
|
30460
30328
|
@private
|
|
30461
30329
|
@method resolverFor
|
|
30462
|
-
@param {Ember.
|
|
30330
|
+
@param {Ember.Enginer} namespace the namespace to look for classes
|
|
30463
30331
|
@return {*} the resolved value for a given lookup
|
|
30464
30332
|
*/
|
|
30465
30333
|
|
|
30466
30334
|
function resolverFor(namespace) {
|
|
30467
|
-
var ResolverClass =
|
|
30335
|
+
var ResolverClass = namespace.Resolver;
|
|
30468
30336
|
var props = {
|
|
30469
30337
|
namespace
|
|
30470
30338
|
};
|
|
@@ -30477,16 +30345,21 @@ define("@ember/engine/index", ["exports", "@ember/engine/lib/engine-parent", "@e
|
|
|
30477
30345
|
// to make sure we have a new `initializers` object, which extends from the parent class' using
|
|
30478
30346
|
// prototypal inheritance. Without this, attempting to add initializers to the subclass would
|
|
30479
30347
|
// pollute the parent class as well as other subclasses.
|
|
30480
|
-
|
|
30481
|
-
|
|
30482
|
-
|
|
30348
|
+
// SAFETY: The superclass may be an Engine, we don't call unless we confirmed it was ok.
|
|
30349
|
+
var superclass = this.superclass;
|
|
30350
|
+
|
|
30351
|
+
if (superclass[bucketName] !== undefined && superclass[bucketName] === this[bucketName]) {
|
|
30352
|
+
var attrs = {
|
|
30353
|
+
[bucketName]: Object.create(this[bucketName])
|
|
30354
|
+
};
|
|
30483
30355
|
this.reopenClass(attrs);
|
|
30484
30356
|
}
|
|
30485
30357
|
|
|
30486
30358
|
(true && !(!this[bucketName][initializer.name]) && (0, _debug.assert)(`The ${humanName} '${initializer.name}' has already been registered`, !this[bucketName][initializer.name]));
|
|
30487
30359
|
(true && !((0, _utils.canInvoke)(initializer, 'initialize')) && (0, _debug.assert)(`An ${humanName} cannot be registered without an initialize function`, (0, _utils.canInvoke)(initializer, 'initialize')));
|
|
30488
30360
|
(true && !(initializer.name !== undefined) && (0, _debug.assert)(`An ${humanName} cannot be registered without a name property`, initializer.name !== undefined));
|
|
30489
|
-
this[bucketName]
|
|
30361
|
+
var initializers = this[bucketName];
|
|
30362
|
+
initializers[initializer.name] = initializer;
|
|
30490
30363
|
};
|
|
30491
30364
|
}
|
|
30492
30365
|
|
|
@@ -30513,7 +30386,7 @@ define("@ember/engine/index", ["exports", "@ember/engine/lib/engine-parent", "@e
|
|
|
30513
30386
|
var _default = Engine;
|
|
30514
30387
|
_exports.default = _default;
|
|
30515
30388
|
});
|
|
30516
|
-
define("@ember/engine/instance", ["exports", "@ember/-internals/runtime", "@ember/debug", "@ember/error", "@ember/-internals/container", "@ember/-internals/utils", "@ember/engine/lib/engine-parent"], function (_exports, _runtime, _debug, _error, _container, _utils, _engineParent) {
|
|
30389
|
+
define("@ember/engine/instance", ["exports", "@ember/-internals/runtime", "@ember/debug", "@ember/error", "@ember/-internals/container", "@ember/-internals/utils", "@ember/engine/lib/engine-parent", "@ember/-internals/runtime/lib/mixins/registry_proxy", "@ember/-internals/runtime/lib/mixins/container_proxy", "@ember/-internals/owner", "@ember/engine"], function (_exports, _runtime, _debug, _error, _container, _utils, _engineParent, _registry_proxy, _container_proxy, _owner, _engine) {
|
|
30517
30390
|
"use strict";
|
|
30518
30391
|
|
|
30519
30392
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -30524,80 +30397,78 @@ define("@ember/engine/instance", ["exports", "@ember/-internals/runtime", "@embe
|
|
|
30524
30397
|
/**
|
|
30525
30398
|
@module @ember/engine
|
|
30526
30399
|
*/
|
|
30400
|
+
var CEngine = _engine.default;
|
|
30527
30401
|
|
|
30528
|
-
|
|
30529
|
-
|
|
30530
|
-
|
|
30531
|
-
|
|
30532
|
-
|
|
30533
|
-
|
|
30534
|
-
@extends EmberObject
|
|
30535
|
-
@uses RegistryProxyMixin
|
|
30536
|
-
@uses ContainerProxyMixin
|
|
30537
|
-
*/
|
|
30538
|
-
var EngineInstance = _runtime.Object.extend(_runtime.RegistryProxyMixin, _runtime.ContainerProxyMixin, {
|
|
30402
|
+
class EngineInstance extends _runtime.Object.extend(_registry_proxy.default, _container_proxy.default) {
|
|
30403
|
+
constructor() {
|
|
30404
|
+
super(...arguments);
|
|
30405
|
+
this._booted = false;
|
|
30406
|
+
this._bootPromise = null;
|
|
30407
|
+
}
|
|
30539
30408
|
/**
|
|
30540
|
-
|
|
30541
|
-
|
|
30542
|
-
|
|
30543
|
-
|
|
30544
|
-
|
|
30409
|
+
@private
|
|
30410
|
+
@method setupRegistry
|
|
30411
|
+
@param {Registry} registry
|
|
30412
|
+
@param {BootOptions} options
|
|
30413
|
+
*/
|
|
30545
30414
|
|
|
30546
|
-
init() {
|
|
30547
|
-
this._super(...arguments); // Ensure the guid gets setup for this instance
|
|
30548
30415
|
|
|
30416
|
+
static setupRegistry(_registry, _options) {}
|
|
30549
30417
|
|
|
30550
|
-
|
|
30551
|
-
var
|
|
30418
|
+
init(properties) {
|
|
30419
|
+
var _a;
|
|
30552
30420
|
|
|
30553
|
-
|
|
30554
|
-
base = this.application;
|
|
30555
|
-
this.base = base;
|
|
30556
|
-
} // Create a per-instance registry that will use the application's registry
|
|
30557
|
-
// as a fallback for resolving registrations.
|
|
30421
|
+
super.init(properties); // Ensure the guid gets setup for this instance
|
|
30558
30422
|
|
|
30423
|
+
(0, _utils.guidFor)(this);
|
|
30424
|
+
(_a = this.base) !== null && _a !== void 0 ? _a : this.base = this.application; // Create a per-instance registry that will use the application's registry
|
|
30425
|
+
// as a fallback for resolving registrations.
|
|
30559
30426
|
|
|
30560
30427
|
var registry = this.__registry__ = new _container.Registry({
|
|
30561
|
-
fallback: base.__registry__
|
|
30428
|
+
fallback: this.base.__registry__
|
|
30562
30429
|
}); // Create a per-instance container from the instance's registry
|
|
30563
30430
|
|
|
30564
30431
|
this.__container__ = registry.container({
|
|
30565
30432
|
owner: this
|
|
30566
30433
|
});
|
|
30567
30434
|
this._booted = false;
|
|
30568
|
-
}
|
|
30569
|
-
|
|
30435
|
+
}
|
|
30570
30436
|
/**
|
|
30571
30437
|
Initialize the `EngineInstance` and return a promise that resolves
|
|
30572
30438
|
with the instance itself when the boot process is complete.
|
|
30573
|
-
|
|
30574
|
-
|
|
30575
|
-
|
|
30439
|
+
The primary task here is to run any registered instance initializers.
|
|
30440
|
+
See the documentation on `BootOptions` for the options it takes.
|
|
30441
|
+
@public
|
|
30576
30442
|
@method boot
|
|
30577
30443
|
@param options {Object}
|
|
30578
30444
|
@return {Promise<EngineInstance,Error>}
|
|
30579
30445
|
*/
|
|
30446
|
+
|
|
30447
|
+
|
|
30580
30448
|
boot(options) {
|
|
30581
30449
|
if (this._bootPromise) {
|
|
30582
30450
|
return this._bootPromise;
|
|
30583
30451
|
}
|
|
30584
30452
|
|
|
30585
|
-
this._bootPromise = new _runtime.RSVP.Promise(resolve =>
|
|
30453
|
+
this._bootPromise = new _runtime.RSVP.Promise(resolve => {
|
|
30454
|
+
resolve(this._bootSync(options));
|
|
30455
|
+
});
|
|
30586
30456
|
return this._bootPromise;
|
|
30587
|
-
}
|
|
30588
|
-
|
|
30457
|
+
}
|
|
30589
30458
|
/**
|
|
30590
30459
|
Unfortunately, a lot of existing code assumes booting an instance is
|
|
30591
30460
|
synchronous – specifically, a lot of tests assume the last call to
|
|
30592
30461
|
`app.advanceReadiness()` or `app.reset()` will result in a new instance
|
|
30593
30462
|
being fully-booted when the current runloop completes.
|
|
30594
|
-
|
|
30463
|
+
We would like new code (like the `visit` API) to stop making this
|
|
30595
30464
|
assumption, so we created the asynchronous version above that returns a
|
|
30596
30465
|
promise. But until we have migrated all the code, we would have to expose
|
|
30597
30466
|
this method for use *internally* in places where we need to boot an instance
|
|
30598
30467
|
synchronously.
|
|
30599
|
-
|
|
30468
|
+
@private
|
|
30600
30469
|
*/
|
|
30470
|
+
|
|
30471
|
+
|
|
30601
30472
|
_bootSync(options) {
|
|
30602
30473
|
if (this._booted) {
|
|
30603
30474
|
return this;
|
|
@@ -30609,7 +30480,7 @@ define("@ember/engine/instance", ["exports", "@ember/-internals/runtime", "@embe
|
|
|
30609
30480
|
this.base.runInstanceInitializers(this);
|
|
30610
30481
|
this._booted = true;
|
|
30611
30482
|
return this;
|
|
30612
|
-
}
|
|
30483
|
+
}
|
|
30613
30484
|
|
|
30614
30485
|
setupRegistry(options) {
|
|
30615
30486
|
if (options === void 0) {
|
|
@@ -30617,32 +30488,35 @@ define("@ember/engine/instance", ["exports", "@ember/-internals/runtime", "@embe
|
|
|
30617
30488
|
}
|
|
30618
30489
|
|
|
30619
30490
|
this.constructor.setupRegistry(this.__registry__, options);
|
|
30620
|
-
}
|
|
30621
|
-
|
|
30491
|
+
}
|
|
30622
30492
|
/**
|
|
30623
30493
|
Unregister a factory.
|
|
30624
|
-
|
|
30494
|
+
Overrides `RegistryProxy#unregister` in order to clear any cached instances
|
|
30625
30495
|
of the unregistered factory.
|
|
30626
|
-
|
|
30496
|
+
@public
|
|
30627
30497
|
@method unregister
|
|
30628
30498
|
@param {String} fullName
|
|
30629
30499
|
*/
|
|
30500
|
+
|
|
30501
|
+
|
|
30630
30502
|
unregister(fullName) {
|
|
30631
|
-
this.__container__.reset(fullName);
|
|
30503
|
+
this.__container__.reset(fullName); // We overwrote this method from RegistryProxyMixin.
|
|
30632
30504
|
|
|
30633
|
-
this._super(...arguments);
|
|
30634
|
-
},
|
|
30635
30505
|
|
|
30506
|
+
this.__registry__.unregister(fullName);
|
|
30507
|
+
}
|
|
30636
30508
|
/**
|
|
30637
30509
|
Build a new `EngineInstance` that's a child of this instance.
|
|
30638
|
-
|
|
30510
|
+
Engines must be registered by name with their parent engine
|
|
30639
30511
|
(or application).
|
|
30640
|
-
|
|
30512
|
+
@private
|
|
30641
30513
|
@method buildChildEngineInstance
|
|
30642
30514
|
@param name {String} the registered name of the engine.
|
|
30643
30515
|
@param options {Object} options provided to the engine instance.
|
|
30644
30516
|
@return {EngineInstance,Error}
|
|
30645
30517
|
*/
|
|
30518
|
+
|
|
30519
|
+
|
|
30646
30520
|
buildChildEngineInstance(name, options) {
|
|
30647
30521
|
if (options === void 0) {
|
|
30648
30522
|
options = {};
|
|
@@ -30654,52 +30528,48 @@ define("@ember/engine/instance", ["exports", "@ember/-internals/runtime", "@embe
|
|
|
30654
30528
|
throw new _error.default(`You attempted to mount the engine '${name}', but it is not registered with its parent.`);
|
|
30655
30529
|
}
|
|
30656
30530
|
|
|
30531
|
+
(true && !(Engine instanceof CEngine) && (0, _debug.assert)('expected an Engine', Engine instanceof CEngine));
|
|
30657
30532
|
var engineInstance = Engine.buildInstance(options);
|
|
30658
30533
|
(0, _engineParent.setEngineParent)(engineInstance, this);
|
|
30659
30534
|
return engineInstance;
|
|
30660
|
-
}
|
|
30661
|
-
|
|
30535
|
+
}
|
|
30662
30536
|
/**
|
|
30663
30537
|
Clone dependencies shared between an engine instance and its parent.
|
|
30664
|
-
|
|
30538
|
+
@private
|
|
30665
30539
|
@method cloneParentDependencies
|
|
30666
30540
|
*/
|
|
30541
|
+
|
|
30542
|
+
|
|
30667
30543
|
cloneParentDependencies() {
|
|
30668
30544
|
var parent = (0, _engineParent.getEngineParent)(this);
|
|
30545
|
+
(true && !(parent) && (0, _debug.assert)('expected parent', parent));
|
|
30669
30546
|
var registrations = ['route:basic', 'service:-routing'];
|
|
30670
|
-
registrations.forEach(key =>
|
|
30547
|
+
registrations.forEach(key => {
|
|
30548
|
+
var registration = parent.resolveRegistration(key);
|
|
30549
|
+
(true && !((0, _owner.isFactory)(registration)) && (0, _debug.assert)('expected registration to be a factory', (0, _owner.isFactory)(registration)));
|
|
30550
|
+
this.register(key, registration);
|
|
30551
|
+
});
|
|
30671
30552
|
var env = parent.lookup('-environment:main');
|
|
30672
30553
|
this.register('-environment:main', env, {
|
|
30673
30554
|
instantiate: false
|
|
30674
30555
|
});
|
|
30675
30556
|
var singletons = ['router:main', (0, _container.privatize)`-bucket-cache:main`, '-view-registry:main', `renderer:-dom`, 'service:-document'];
|
|
30676
30557
|
|
|
30677
|
-
if (env
|
|
30558
|
+
if (env['isInteractive']) {
|
|
30678
30559
|
singletons.push('event_dispatcher:main');
|
|
30679
30560
|
}
|
|
30680
30561
|
|
|
30681
|
-
singletons.forEach(key =>
|
|
30682
|
-
|
|
30683
|
-
|
|
30562
|
+
singletons.forEach(key => {
|
|
30563
|
+
// SAFETY: We already expect this to be a singleton
|
|
30564
|
+
var singleton = parent.lookup(key);
|
|
30565
|
+
this.register(key, singleton, {
|
|
30566
|
+
instantiate: false
|
|
30567
|
+
});
|
|
30568
|
+
});
|
|
30684
30569
|
}
|
|
30685
30570
|
|
|
30686
|
-
}
|
|
30687
|
-
|
|
30688
|
-
EngineInstance.reopenClass({
|
|
30689
|
-
/**
|
|
30690
|
-
@private
|
|
30691
|
-
@method setupRegistry
|
|
30692
|
-
@param {Registry} registry
|
|
30693
|
-
@param {BootOptions} options
|
|
30694
|
-
*/
|
|
30695
|
-
setupRegistry(registry, options) {
|
|
30696
|
-
// when no options/environment is present, do nothing
|
|
30697
|
-
if (!options) {
|
|
30698
|
-
return;
|
|
30699
|
-
}
|
|
30700
|
-
}
|
|
30571
|
+
}
|
|
30701
30572
|
|
|
30702
|
-
});
|
|
30703
30573
|
var _default = EngineInstance;
|
|
30704
30574
|
_exports.default = _default;
|
|
30705
30575
|
});
|
|
@@ -54762,7 +54632,7 @@ define("ember/version", ["exports"], function (_exports) {
|
|
|
54762
54632
|
value: true
|
|
54763
54633
|
});
|
|
54764
54634
|
_exports.default = void 0;
|
|
54765
|
-
var _default = "4.
|
|
54635
|
+
var _default = "4.5.0-alpha.2";
|
|
54766
54636
|
_exports.default = _default;
|
|
54767
54637
|
});
|
|
54768
54638
|
define("route-recognizer", ["exports"], function (_exports) {
|