language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | emberjs | ember.js | 1d08c84e5d8cada2a324a595e6159e57ddd0a6f1.json | Add feature flag for visit API | packages/ember-application/lib/system/application.js | @@ -284,7 +284,7 @@ var Application = Namespace.extend(DeferredMixin, {
// decremented by the Application's own `initialize` method.
this._readinessDeferrals = 1;
- if (this.autoboot) {
+ if (!Ember.FEATURES.isEnabled('ember-application-visit') || this.autoboot) {
// Create subclass of Ember.Router for this Application instance.
// This is to ensure that someone reopening `App.Router` does not
// tamper with the default `Ember.Router`.
@@ -759,38 +759,6 @@ var Application = Namespace.extend(DeferredMixin, {
this.constructor.initializer(options);
},
- /**
- Creates a new instance of the application and instructs it to route to the
- specified initial URL. This method returns a promise that will be resolved
- once rendering is complete. That promise is resolved with the instance.
-
- ```js
- App.visit('/users').then(function(instance) {
- var view = instance.view;
- view.appendTo('#qunit-test-fixtures');
- });
- ```
-
- @method visit
- @private
- */
- visit: function(url) {
- var instance = this.buildInstance();
-
- var renderPromise = new Ember.RSVP.Promise(function(res, rej) {
- instance.didCreateRootView = function(view) {
- instance.view = view;
- res(instance);
- };
- });
-
- instance.setupRouter({ location: 'none' });
-
- return instance.handleURL(url).then(function() {
- return renderPromise;
- });
- },
-
/**
@method then
@private
@@ -815,6 +783,42 @@ if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) {
});
}
+if (Ember.FEATURES.isEnabled('ember-application-visit')) {
+ Application.reopen({
+ /**
+ Creates a new instance of the application and instructs it to route to the
+ specified initial URL. This method returns a promise that will be resolved
+ once rendering is complete. That promise is resolved with the instance.
+
+ ```js
+ App.visit('/users').then(function(instance) {
+ var view = instance.view;
+ view.appendTo('#qunit-test-fixtures');
+ });
+ ```
+
+ @method visit
+ @private
+ */
+ visit: function(url) {
+ var instance = this.buildInstance();
+
+ var renderPromise = new Ember.RSVP.Promise(function(res, rej) {
+ instance.didCreateRootView = function(view) {
+ instance.view = view;
+ res(instance);
+ };
+ });
+
+ instance.setupRouter({ location: 'none' });
+
+ return instance.handleURL(url).then(function() {
+ return renderPromise;
+ });
+ }
+ });
+}
+
Application.reopenClass({
initializers: create(null),
instanceInitializers: create(null), | true |
Other | emberjs | ember.js | be6a683242662eb9cc2e8af8b8e829465b7c0dd4.json | Use imported `run` | packages/ember-application/lib/system/application.js | @@ -354,7 +354,7 @@ var Application = Namespace.extend(DeferredMixin, {
if (!this.$ || this.$.isReady) {
run.schedule('actions', this, 'domReady', _instance);
} else {
- this.$().ready(Ember.run.bind(this, 'domReady', _instance));
+ this.$().ready(run.bind(this, 'domReady', _instance));
}
},
| false |
Other | emberjs | ember.js | f0aa38781b835e3463fe251f875452ba7a292113.json | Create a registry per ApplicationInstance
The instance's registry sets its fallback to the corresponding
application's registry. | packages/ember-application/lib/system/application-instance.js | @@ -7,6 +7,7 @@
import { set } from "ember-metal/property_set";
import EmberObject from "ember-runtime/system/object";
import run from "ember-metal/run_loop";
+import Registry from 'container/registry';
/**
The `ApplicationInstance` encapsulates all of the stateful aspects of a
@@ -44,6 +45,14 @@ export default EmberObject.extend({
@property {Ember.Registry} registry
*/
+ applicationRegistry: null,
+
+ /**
+ The registry for this application instance. It should use the
+ `applicationRegistry` as a fallback.
+
+ @property {Ember.Registry} registry
+ */
registry: null,
/**
@@ -71,21 +80,27 @@ export default EmberObject.extend({
init: function() {
this._super.apply(this, arguments);
+
+ // Create a per-instance registry that will use the application's registry
+ // as a fallback for resolving registrations.
+ this.registry = new Registry({
+ fallback: this.applicationRegistry,
+ resolver: this.applicationRegistry.resolver
+ });
+ this.registry.normalizeFullName = this.applicationRegistry.normalizeFullName;
+ this.registry.makeToString = this.applicationRegistry.makeToString;
+
+ // Create a per-instance container from the instance's registry
this.container = this.registry.container();
- // Currently, we cannot put the application instance into the container
- // because the registry is "sealed" by this point and we do not yet
- // support container-specific subregistries. This code puts the instance
- // directly into the container's cache so that lookups work, but it
- // would obviously be much better to support registering on the container
- // directly.
+ // Register this instance in the per-instance registry.
//
- // Why do we need to put the instance in the container in the first place?
+ // Why do we need to register the instance in the first place?
// Because we need a good way for the root route (a.k.a ApplicationRoute)
// to notify us when it has created the root-most view. That view is then
// appended to the rootElement, in the case of apps, to the fixture harness
// in tests, or rendered to a string in the case of FastBoot.
- this.container.cache['-application-instance:main'] = this;
+ this.registry.register('-application-instance:main', this, { instantiate: false });
},
/** | true |
Other | emberjs | ember.js | f0aa38781b835e3463fe251f875452ba7a292113.json | Create a registry per ApplicationInstance
The instance's registry sets its fallback to the corresponding
application's registry. | packages/ember-application/lib/system/application.js | @@ -318,7 +318,7 @@ var Application = Namespace.extend(DeferredMixin, {
return ApplicationInstance.create({
customEvents: get(this, 'customEvents'),
rootElement: get(this, 'rootElement'),
- registry: this.registry
+ applicationRegistry: this.registry
});
},
| true |
Other | emberjs | ember.js | ebfa23d2ab6812e08decada806ce10381aac7a81.json | Introduce fallback registry.
A registry's fallback registry resolves registrations and injections
when no matches can be found. | packages/container/lib/container.js | @@ -270,8 +270,8 @@ function injectionsFor(container, fullName) {
var type = splitName[0];
var injections = buildInjections(container,
- registry.typeInjections[type],
- registry.injections[fullName]);
+ registry.getTypeInjections(type),
+ registry.getInjections(fullName));
injections._debugContainerKey = fullName;
injections.container = container;
@@ -284,8 +284,8 @@ function factoryInjectionsFor(container, fullName) {
var type = splitName[0];
var factoryInjections = buildInjections(container,
- registry.factoryTypeInjections[type],
- registry.factoryInjections[fullName]);
+ registry.getFactoryTypeInjections(type),
+ registry.getFactoryInjections(fullName));
factoryInjections._debugContainerKey = fullName;
return factoryInjections; | true |
Other | emberjs | ember.js | ebfa23d2ab6812e08decada806ce10381aac7a81.json | Introduce fallback registry.
A registry's fallback registry resolves registrations and injections
when no matches can be found. | packages/container/lib/registry.js | @@ -18,22 +18,33 @@ var VALID_FULL_NAME_REGEXP = /^[^:]+.+:[^:]+$/;
@class Registry
*/
function Registry(options) {
+ this.fallback = options && options.fallback ? options.fallback : null;
+
this.resolver = options && options.resolver ? options.resolver : function() {};
this.registrations = dictionary(options && options.registrations ? options.registrations : null);
- this.typeInjections = dictionary(options && options.typeInjections ? options.typeInjections : null);
- this.injections = dictionary(null);
- this.factoryTypeInjections = dictionary(null);
- this.factoryInjections = dictionary(null);
- this._normalizeCache = dictionary(null);
- this._resolveCache = dictionary(null);
+ this._typeInjections = dictionary(null);
+ this._injections = dictionary(null);
+ this._factoryTypeInjections = dictionary(null);
+ this._factoryInjections = dictionary(null);
+
+ this._normalizeCache = dictionary(null);
+ this._resolveCache = dictionary(null);
- this._options = dictionary(options && options.options ? options.options : null);
- this._typeOptions = dictionary(options && options.typeOptions ? options.typeOptions : null);
+ this._options = dictionary(null);
+ this._typeOptions = dictionary(null);
}
Registry.prototype = {
+ /**
+ A backup registry for resolving registrations when no matches can be found.
+
+ @property fallback
+ @type Registry
+ */
+ fallback: null,
+
/**
@property resolver
@type function
@@ -47,28 +58,36 @@ Registry.prototype = {
registrations: null,
/**
- @property typeInjections
+ @private
+
+ @property _typeInjections
@type InheritingDict
*/
- typeInjections: null,
+ _typeInjections: null,
/**
- @property injections
+ @private
+
+ @property _injections
@type InheritingDict
*/
- injections: null,
+ _injections: null,
/**
- @property factoryTypeInjections
+ @private
+
+ @property _factoryTypeInjections
@type InheritingDict
*/
- factoryTypeInjections: null,
+ _factoryTypeInjections: null,
/**
- @property factoryInjections
+ @private
+
+ @property _factoryInjections
@type InheritingDict
*/
- factoryInjections: null,
+ _factoryInjections: null,
/**
@private
@@ -249,7 +268,11 @@ Registry.prototype = {
*/
resolve: function(fullName) {
Ember.assert('fullName must be a proper full name', this.validateFullName(fullName));
- return resolve(this, this.normalize(fullName));
+ var factory = resolve(this, this.normalize(fullName));
+ if (factory === undefined && this.fallback) {
+ factory = this.fallback.resolve(fullName);
+ }
+ return factory;
},
/**
@@ -349,7 +372,11 @@ Registry.prototype = {
},
getOptionsForType: function(type) {
- return this._typeOptions[type];
+ var optionsForType = this._typeOptions[type];
+ if (optionsForType === undefined && this.fallback) {
+ optionsForType = this.fallback.getOptionsForType(type);
+ }
+ return optionsForType;
},
/**
@@ -365,7 +392,11 @@ Registry.prototype = {
getOptions: function(fullName) {
var normalizedName = this.normalize(fullName);
- return this._options[normalizedName];
+ var options = this._options[normalizedName];
+ if (options === undefined && this.fallback) {
+ options = this.fallback.getOptions(fullName);
+ }
+ return options;
},
getOption: function(fullName, optionName) {
@@ -378,8 +409,11 @@ Registry.prototype = {
var type = fullName.split(':')[0];
options = this._typeOptions[type];
- if (options) {
+ if (options && options[optionName] !== undefined) {
return options[optionName];
+
+ } else if (this.fallback) {
+ return this.fallback.getOption(fullName, optionName);
}
},
@@ -435,8 +469,8 @@ Registry.prototype = {
'` as a different type and perform the typeInjection.');
}
- var injections = this.typeInjections[type] ||
- (this.typeInjections[type] = []);
+ var injections = this._typeInjections[type] ||
+ (this._typeInjections[type] = []);
injections.push({
property: property,
@@ -500,8 +534,8 @@ Registry.prototype = {
Ember.assert('fullName must be a proper full name', this.validateFullName(fullName));
var normalizedName = this.normalize(fullName);
- var injections = this.injections[normalizedName] ||
- (this.injections[normalizedName] = []);
+ var injections = this._injections[normalizedName] ||
+ (this._injections[normalizedName] = []);
injections.push({
property: property,
@@ -540,8 +574,8 @@ Registry.prototype = {
@param {String} fullName
*/
factoryTypeInjection: function(type, property, fullName) {
- var injections = this.factoryTypeInjections[type] ||
- (this.factoryTypeInjections[type] = []);
+ var injections = this._factoryTypeInjections[type] ||
+ (this._factoryTypeInjections[type] = []);
injections.push({
property: property,
@@ -609,7 +643,7 @@ Registry.prototype = {
return this.factoryTypeInjection(normalizedName, property, normalizedInjectionName);
}
- var injections = this.factoryInjections[normalizedName] || (this.factoryInjections[normalizedName] = []);
+ var injections = this._factoryInjections[normalizedName] || (this._factoryInjections[normalizedName] = []);
injections.push({
property: property,
@@ -652,6 +686,38 @@ Registry.prototype = {
}
}
+ return injections;
+ },
+
+ getInjections: function(fullName) {
+ var injections = this._injections[fullName] || [];
+ if (this.fallback) {
+ injections = injections.concat(this.fallback.getInjections(fullName));
+ }
+ return injections;
+ },
+
+ getTypeInjections: function(type) {
+ var injections = this._typeInjections[type] || [];
+ if (this.fallback) {
+ injections = injections.concat(this.fallback.getTypeInjections(type));
+ }
+ return injections;
+ },
+
+ getFactoryInjections: function(fullName) {
+ var injections = this._factoryInjections[fullName] || [];
+ if (this.fallback) {
+ injections = injections.concat(this.fallback.getFactoryInjections(fullName));
+ }
+ return injections;
+ },
+
+ getFactoryTypeInjections: function(type) {
+ var injections = this._factoryTypeInjections[type] || [];
+ if (this.fallback) {
+ injections = injections.concat(this.fallback.getFactoryTypeInjections(type));
+ }
return injections;
}
}; | true |
Other | emberjs | ember.js | ebfa23d2ab6812e08decada806ce10381aac7a81.json | Introduce fallback registry.
A registry's fallback registry resolves registrations and injections
when no matches can be found. | packages/container/tests/registry_test.js | @@ -72,7 +72,7 @@ test("The registry can take a hook to resolve factories lazily", function() {
strictEqual(registry.resolve('controller:post'), PostController, "The correct factory was provided");
});
-test("The registry respect the resolver hook for `has`", function() {
+test("The registry respects the resolver hook for `has`", function() {
var registry = new Registry();
var PostController = factory();
@@ -275,3 +275,73 @@ test("registry.container creates an associated container", function() {
ok(postController instanceof PostController, "The lookup is an instance of the registered factory");
strictEqual(registry._defaultContainer, container, "_defaultContainer is set to the first created container and used for Ember 1.x Container compatibility");
});
+
+test("`resolve` can be handled by a fallback registry", function() {
+ var fallback = new Registry();
+
+ var registry = new Registry({ fallback: fallback });
+ var PostController = factory();
+
+ fallback.register('controller:post', PostController);
+
+ var PostControllerFactory = registry.resolve('controller:post');
+
+ ok(PostControllerFactory, 'factory is returned');
+ ok(PostControllerFactory.create() instanceof PostController, "The return of factory.create is an instance of PostController");
+});
+
+test("`has` can be handled by a fallback registry", function() {
+ var fallback = new Registry();
+
+ var registry = new Registry({ fallback: fallback });
+ var PostController = factory();
+
+ fallback.register('controller:post', PostController);
+
+ equal(registry.has('controller:post'), true, "Fallback registry is checked for registration");
+});
+
+test("`getInjections` includes injections from a fallback registry", function() {
+ var fallback = new Registry();
+ var registry = new Registry({ fallback: fallback });
+
+ equal(registry.getInjections('model:user').length, 0, "No injections in the primary registry");
+
+ fallback.injection('model:user', 'post', 'model:post');
+
+ equal(registry.getInjections('model:user').length, 1, "Injections from the fallback registry are merged");
+});
+
+test("`getTypeInjections` includes type injections from a fallback registry", function() {
+ var fallback = new Registry();
+ var registry = new Registry({ fallback: fallback });
+
+ equal(registry.getTypeInjections('model').length, 0, "No injections in the primary registry");
+
+ fallback.injection('model', 'source', 'source:main');
+
+ equal(registry.getTypeInjections('model').length, 1, "Injections from the fallback registry are merged");
+});
+
+test("`getFactoryInjections` includes factory injections from a fallback registry", function() {
+ var fallback = new Registry();
+ var registry = new Registry({ fallback: fallback });
+
+ equal(registry.getFactoryInjections('model:user').length, 0, "No factory injections in the primary registry");
+
+ fallback.factoryInjection('model:user', 'store', 'store:main');
+
+ equal(registry.getFactoryInjections('model:user').length, 1, "Factory injections from the fallback registry are merged");
+});
+
+
+test("`getFactoryTypeInjections` includes factory type injections from a fallback registry", function() {
+ var fallback = new Registry();
+ var registry = new Registry({ fallback: fallback });
+
+ equal(registry.getFactoryTypeInjections('model').length, 0, "No factory type injections in the primary registry");
+
+ fallback.factoryInjection('model', 'store', 'store:main');
+
+ equal(registry.getFactoryTypeInjections('model').length, 1, "Factory type injections from the fallback registry are merged");
+}); | true |
Other | emberjs | ember.js | 3bb454762ce7d62f03bb6f778f9a3831829b72fa.json | Allow deps to be empty in loader. | packages/loader/lib/main.js | @@ -12,7 +12,17 @@ var mainContext = this;
var seen = {};
define = function(name, deps, callback) {
- registry[name] = { deps: deps, callback: callback };
+ var value = { };
+
+ if (!callback) {
+ value.deps = [];
+ value.callback = deps;
+ } else {
+ value.deps = deps;
+ value.callback = callback;
+ }
+
+ registry[name] = value;
};
requirejs = require = requireModule = function(name) { | false |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-application/lib/system/application.js | @@ -12,7 +12,7 @@ import { runLoadHooks } from "ember-runtime/system/lazy_load";
import Namespace from "ember-runtime/system/namespace";
import DeferredMixin from "ember-runtime/mixins/deferred";
import DefaultResolver from "ember-application/system/resolver";
-import { create } from "ember-metal/platform";
+import create from "ember-metal/platform/create";
import run from "ember-metal/run_loop";
import { canInvoke } from "ember-metal/utils";
import Controller from "ember-runtime/controllers/controller"; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-htmlbars/lib/helpers.js | @@ -3,7 +3,7 @@
@submodule ember-htmlbars
*/
-import { create as o_create } from "ember-metal/platform";
+import o_create from "ember-metal/platform/create";
/**
@private | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-htmlbars/tests/integration/escape_integration_test.js | @@ -3,7 +3,7 @@ import EmberView from 'ember-views/views/view';
import compile from 'ember-template-compiler/system/compile';
import { set } from 'ember-metal/property_set';
-import { create as o_create } from 'ember-metal/platform';
+import o_create from 'ember-metal/platform/create';
import { runAppend, runDestroy } from "ember-runtime/tests/utils";
var view; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal-views/tests/test_helpers.js | @@ -1,4 +1,4 @@
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
import { Renderer } from "ember-metal-views";
var renderer; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/alias.js | @@ -7,7 +7,7 @@ import {
defineProperty
} from "ember-metal/properties";
import { ComputedProperty } from "ember-metal/computed";
-import { create } from "ember-metal/platform";
+import create from "ember-metal/platform/create";
import {
meta,
inspect | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/dependent_keys.js | @@ -3,9 +3,7 @@
//
// REMOVE_USE_STRICT: true
-import {
- create as o_create
-} from "ember-metal/platform";
+import o_create from "ember-metal/platform/create";
import {
watch,
unwatch | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/deprecate_property.js | @@ -3,7 +3,7 @@
*/
import Ember from "ember-metal/core";
-import { hasPropertyAccessors } from "ember-metal/platform";
+import { hasPropertyAccessors } from "ember-metal/platform/define_property";
import { defineProperty } from "ember-metal/properties";
import { get } from "ember-metal/property_get";
import { set } from "ember-metal/property_set"; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/dictionary.js | @@ -1,4 +1,4 @@
-import { create } from "ember-metal/platform";
+import create from "ember-metal/platform/create";
// the delete is meant to hint at runtimes that this object should remain in
// dictionary mode. This is clearly a runtime specific hack, but currently it | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/error.js | @@ -1,4 +1,4 @@
-import { create } from "ember-metal/platform";
+import create from "ember-metal/platform/create";
var errorProps = [
'description', | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/events.js | @@ -13,7 +13,7 @@ import {
apply,
applyStr
} from "ember-metal/utils";
-import { create } from "ember-metal/platform";
+import create from "ember-metal/platform/create";
var a_slice = [].slice;
| true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/injected_property.js | @@ -2,7 +2,7 @@ import Ember from "ember-metal/core"; // Ember.assert
import { ComputedProperty } from "ember-metal/computed";
import { AliasedProperty } from "ember-metal/alias";
import { Descriptor } from "ember-metal/properties";
-import { create } from "ember-metal/platform";
+import create from "ember-metal/platform/create";
import { meta } from "ember-metal/utils";
/** | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/keys.js | @@ -1,4 +1,4 @@
-import { canDefineNonEnumerableProperties } from 'ember-metal/platform';
+import { canDefineNonEnumerableProperties } from 'ember-metal/platform/define_property';
/**
Returns all of the keys defined on an object or hash. This is useful | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/main.js | @@ -41,9 +41,9 @@ import EmberError from "ember-metal/error";
import EnumerableUtils from "ember-metal/enumerable_utils";
import Cache from "ember-metal/cache";
import {
- create,
hasPropertyAccessors
-} from "ember-metal/platform";
+} from 'ember-metal/platform/define_property';
+import create from 'ember-metal/platform/create';
import {
filter,
forEach, | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/map.js | @@ -22,7 +22,7 @@
import { guidFor } from "ember-metal/utils";
import { indexOf } from "ember-metal/array";
-import { create } from "ember-metal/platform";
+import create from "ember-metal/platform/create";
import { deprecateProperty } from "ember-metal/deprecate_property";
function missingFunction(fn) { | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/mixin.js | @@ -14,9 +14,7 @@ import {
indexOf as a_indexOf,
forEach as a_forEach
} from "ember-metal/array";
-import {
- create as o_create
-} from "ember-metal/platform";
+import o_create from "ember-metal/platform/create";
import { get } from "ember-metal/property_get";
import { set, trySet } from "ember-metal/property_set";
import { | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/platform.js | @@ -1,30 +0,0 @@
-import {
- hasES5CompliantDefineProperty,
- defineProperty
-} from 'ember-metal/platform/define_property';
-import defineProperties from 'ember-metal/platform/define_properties';
-import create from 'ember-metal/platform/create';
-
-/**
-@module ember-metal
-*/
-
-var hasPropertyAccessors = hasES5CompliantDefineProperty;
-var canDefineNonEnumerableProperties = hasES5CompliantDefineProperty;
-
-/**
- Platform specific methods and feature detectors needed by the framework.
-
- @class platform
- @namespace Ember
- @static
-*/
-
-export {
- create,
- defineProperty,
- defineProperties,
- hasPropertyAccessors,
- canDefineNonEnumerableProperties
-};
- | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/platform/define_property.js | @@ -121,12 +121,17 @@ if (hasES5CompliantDefineProperty && typeof document !== 'undefined') {
}
if (!hasES5CompliantDefineProperty) {
- defineProperty = function defineProperty(obj, keyName, desc) {
+ defineProperty = function definePropertyPolyfill(obj, keyName, desc) {
if (!desc.get) { obj[keyName] = desc.value; }
};
}
+var hasPropertyAccessors = hasES5CompliantDefineProperty;
+var canDefineNonEnumerableProperties = hasES5CompliantDefineProperty;
+
export {
hasES5CompliantDefineProperty,
- defineProperty
+ defineProperty,
+ hasPropertyAccessors,
+ canDefineNonEnumerableProperties
}; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/properties.js | @@ -7,7 +7,7 @@ import { meta as metaFor } from "ember-metal/utils";
import {
defineProperty as objectDefineProperty,
hasPropertyAccessors
-} from "ember-metal/platform";
+} from 'ember-metal/platform/define_property';
import { overrideChains } from "ember-metal/property_events";
// ..........................................................
// DESCRIPTOR | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/property_get.js | @@ -9,7 +9,7 @@ import {
isPath,
hasThis as pathHasThis
} from "ember-metal/path_cache";
-import { hasPropertyAccessors } from "ember-metal/platform";
+import { hasPropertyAccessors } from "ember-metal/platform/define_property";
var FIRST_KEY = /^([^\.]+)/;
| true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/property_set.js | @@ -9,7 +9,7 @@ import EmberError from "ember-metal/error";
import {
isPath
} from "ember-metal/path_cache";
-import { hasPropertyAccessors } from "ember-metal/platform";
+import { hasPropertyAccessors } from "ember-metal/platform/define_property";
var IS_GLOBAL = /^([A-Z$]|([0-9][A-Z$]))/;
| true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/streams/conditional.js | @@ -5,7 +5,7 @@ import {
unsubscribe,
isStream
} from "ember-metal/streams/utils";
-import { create } from "ember-metal/platform";
+import create from "ember-metal/platform/create";
export default function conditional(test, consequent, alternate) {
if (isStream(test)) { | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/streams/simple.js | @@ -1,6 +1,6 @@
import merge from "ember-metal/merge";
import Stream from "ember-metal/streams/stream";
-import { create } from "ember-metal/platform";
+import create from "ember-metal/platform/create";
import { read, isStream } from "ember-metal/streams/utils";
function SimpleStream(source) { | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/streams/stream.js | @@ -1,4 +1,4 @@
-import { create } from "ember-metal/platform";
+import create from "ember-metal/platform/create";
import {
getFirstKey,
getTailPath | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/streams/stream_binding.js | @@ -1,4 +1,4 @@
-import { create } from "ember-metal/platform";
+import create from "ember-metal/platform/create";
import merge from "ember-metal/merge";
import run from "ember-metal/run_loop";
import Stream from "ember-metal/streams/stream"; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/utils.js | @@ -4,12 +4,12 @@
// REMOVE_USE_STRICT: true
import Ember from "ember-metal/core";
+import o_create from 'ember-metal/platform/create';
import {
- defineProperty as o_defineProperty,
- canDefineNonEnumerableProperties,
hasPropertyAccessors,
- create as o_create
-} from "ember-metal/platform";
+ defineProperty as o_defineProperty,
+ canDefineNonEnumerableProperties
+} from 'ember-metal/platform/define_property';
import {
forEach | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/lib/watch_key.js | @@ -6,7 +6,7 @@ import {
import {
defineProperty as o_defineProperty,
hasPropertyAccessors
-} from "ember-metal/platform";
+} from "ember-metal/platform/define_property";
import {
MANDATORY_SETTER_FUNCTION,
DEFAULT_GETTER_FUNCTION | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/tests/accessors/get_path_test.js | @@ -3,9 +3,10 @@
import { get } from 'ember-metal/property_get';
function expectGlobalContextDeprecation(assertion) {
- expectDeprecation(function() {
- assertion();
- }, "Ember.get fetched 'localPathGlobal' from the global context. This behavior will change in the future (issue #3852)");
+ expectDeprecation(
+ assertion,
+ "Ember.get fetched 'localPathGlobal' from the global context. This behavior will change in the future (issue #3852)"
+ );
}
var obj; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/tests/accessors/get_test.js | @@ -8,7 +8,7 @@ import {
observer
} from 'ember-metal/mixin';
import { addObserver } from "ember-metal/observer";
-import { create } from 'ember-metal/platform';
+import create from 'ember-metal/platform/create';
QUnit.module('Ember.get');
| true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/tests/accessors/mandatory_setters_test.js | @@ -3,9 +3,9 @@ import { set } from "ember-metal/property_set";
import { watch } from "ember-metal/watching";
import {
hasPropertyAccessors,
- defineProperty,
- create
-} from "ember-metal/platform";
+ defineProperty
+} from "ember-metal/platform/define_property";
+import create from 'ember-metal/platform/create';
import { meta as metaFor } from "ember-metal/utils";
QUnit.module('mandatory-setters'); | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/tests/chains_test.js | @@ -1,6 +1,6 @@
import { addObserver } from "ember-metal/observer";
import { finishChains } from "ember-metal/chains";
-import { create } from 'ember-metal/platform';
+import create from 'ember-metal/platform/create';
QUnit.module("Chains");
| true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/tests/computed_test.js | @@ -1,6 +1,6 @@
import Ember from 'ember-metal/core';
import { testBoth } from 'ember-metal/tests/props_helper';
-import { create } from 'ember-metal/platform';
+import create from 'ember-metal/platform/create';
import {
ComputedProperty,
computed, | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/tests/core/inspect_test.js | @@ -1,5 +1,5 @@
import { inspect } from "ember-metal/utils";
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
QUnit.module("Ember.inspect");
| true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/tests/events_test.js | @@ -1,5 +1,5 @@
import { Mixin } from 'ember-metal/mixin';
-import { create } from 'ember-metal/platform';
+import create from 'ember-metal/platform/create';
import { meta } from 'ember-metal/utils';
import { | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/tests/map_test.js | @@ -6,7 +6,7 @@ import {
import {
hasPropertyAccessors
-} from "ember-metal/platform";
+} from "ember-metal/platform/define_property";
var object, number, string, map, variety;
var varieties = [['Map', Map], ['MapWithDefault', MapWithDefault]]; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/tests/mixin/method_test.js | @@ -1,4 +1,4 @@
-import { create } from 'ember-metal/platform';
+import create from 'ember-metal/platform/create';
import {
mixin,
Mixin | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/tests/observer_test.js | @@ -12,7 +12,7 @@ import {
propertyWillChange,
propertyDidChange
} from 'ember-metal/property_events';
-import { create } from 'ember-metal/platform';
+import create from 'ember-metal/platform/create';
import { defineProperty } from 'ember-metal/properties';
import {
computed, | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/tests/platform/create_test.js | @@ -1,4 +1,4 @@
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
QUnit.module("Ember.create()");
| true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/tests/platform/define_property_test.js | @@ -1,4 +1,8 @@
-import { defineProperty, hasPropertyAccessors, canDefineNonEnumerableProperties } from 'ember-metal/platform';
+import {
+ defineProperty,
+ hasPropertyAccessors,
+ canDefineNonEnumerableProperties
+} from 'ember-metal/platform/define_property';
import EnumerableUtils from 'ember-metal/enumerable_utils';
function isEnumerable(obj, keyName) { | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/tests/properties_test.js | @@ -1,4 +1,4 @@
-import { hasPropertyAccessors } from "ember-metal/platform";
+import { hasPropertyAccessors } from "ember-metal/platform/define_property";
import { computed } from 'ember-metal/computed';
import { defineProperty } from "ember-metal/properties";
import { deprecateProperty } from "ember-metal/deprecate_property"; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-metal/tests/utils/meta_test.js | @@ -1,9 +1,9 @@
/*global jQuery*/
import Ember from 'ember-metal/core';
import {
- create,
canDefineNonEnumerableProperties
-} from 'ember-metal/platform';
+} from 'ember-metal/platform/define_property';
+import create from 'ember-metal/platform/create';
import {
getMeta,
setMeta, | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-routing-htmlbars/tests/helpers/render_test.js | @@ -1,7 +1,7 @@
import Ember from 'ember-metal/core'; // TEMPLATES
import { set } from "ember-metal/property_set";
import run from "ember-metal/run_loop";
-import { canDefineNonEnumerableProperties } from 'ember-metal/platform';
+import { canDefineNonEnumerableProperties } from 'ember-metal/platform/define_property';
import { observer } from 'ember-metal/mixin';
import Namespace from "ember-runtime/system/namespace"; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-routing/lib/system/router.js | @@ -19,7 +19,7 @@ import {
getActiveTargetName,
stashParamNames
} from "ember-routing/utils";
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
import RouterState from "./router_state";
| true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-runtime/lib/computed/array_computed.js | @@ -3,7 +3,7 @@ import {
ReduceComputedProperty
} from 'ember-runtime/computed/reduce_computed';
import { forEach } from 'ember-metal/enumerable_utils';
-import { create as o_create } from 'ember-metal/platform';
+import o_create from 'ember-metal/platform/create';
import { addObserver } from 'ember-metal/observer';
import EmberError from 'ember-metal/error';
| true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-runtime/lib/computed/reduce_computed.js | @@ -21,7 +21,7 @@ import {
ComputedProperty,
cacheFor
} from 'ember-metal/computed';
-import { create as o_create } from 'ember-metal/platform';
+import o_create from 'ember-metal/platform/create';
import { forEach } from 'ember-metal/enumerable_utils';
import TrackedArray from 'ember-runtime/system/tracked_array';
import EmberArray from 'ember-runtime/mixins/array'; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-runtime/lib/system/core_object.js | @@ -21,7 +21,7 @@ import {
guidFor,
apply
} from "ember-metal/utils";
-import { create as o_create } from "ember-metal/platform";
+import o_create from 'ember-metal/platform/create';
import {
generateGuid,
GUID_KEY_PROPERTY,
@@ -38,7 +38,7 @@ import {
} from "ember-metal/mixin";
import { indexOf } from "ember-metal/enumerable_utils";
import EmberError from "ember-metal/error";
-import { defineProperty as o_defineProperty } from "ember-metal/platform";
+import { defineProperty as o_defineProperty } from "ember-metal/platform/define_property";
import keys from "ember-metal/keys";
import ActionHandler from "ember-runtime/mixins/action_handler";
import { defineProperty } from "ember-metal/properties";
@@ -50,7 +50,7 @@ import { destroy } from "ember-metal/watching";
import {
K
} from 'ember-metal/core';
-import { hasPropertyAccessors } from "ember-metal/platform";
+import { hasPropertyAccessors } from "ember-metal/platform/define_property";
import { validatePropertyInjections } from "ember-runtime/inject";
var schedule = run.schedule; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-runtime/tests/core/copy_test.js | @@ -1,4 +1,4 @@
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
import copy from "ember-runtime/copy";
QUnit.module("Ember Copy Method"); | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-runtime/tests/ext/mixin_test.js | @@ -1,7 +1,7 @@
import {set} from "ember-metal/property_set";
import {get} from "ember-metal/property_get";
import {Mixin} from "ember-metal/mixin";
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
import { Binding } from "ember-metal/binding";
import run from "ember-metal/run_loop";
| true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-runtime/tests/mixins/promise_proxy_test.js | @@ -1,4 +1,4 @@
-import {create} from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
import {get} from "ember-metal/property_get";
import run from "ember-metal/run_loop";
import ObjectProxy from "ember-runtime/system/object_proxy"; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-runtime/tests/system/object/destroy_test.js | @@ -1,5 +1,5 @@
import run from "ember-metal/run_loop";
-import { hasPropertyAccessors } from "ember-metal/platform";
+import { hasPropertyAccessors } from "ember-metal/platform/define_property";
import { observer } from "ember-metal/mixin";
import { set } from "ember-metal/property_set";
import { bind } from "ember-metal/binding"; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-testing/lib/test.js | @@ -1,6 +1,6 @@
import Ember from "ember-metal/core";
import emberRun from "ember-metal/run_loop";
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
import RSVP from "ember-runtime/ext/rsvp";
import setupForTesting from "ember-testing/setup_for_testing";
import EmberApplication from "ember-application/system/application"; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-views/lib/streams/context_stream.js | @@ -1,7 +1,7 @@
import Ember from 'ember-metal/core';
import merge from "ember-metal/merge";
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
import { isGlobal } from "ember-metal/path_cache";
import Stream from "ember-metal/streams/stream";
import SimpleStream from "ember-metal/streams/simple"; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-views/lib/streams/key_stream.js | @@ -1,7 +1,7 @@
import Ember from 'ember-metal/core';
import merge from "ember-metal/merge";
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
import { get } from "ember-metal/property_get";
import { set } from "ember-metal/property_set";
import { | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-views/lib/streams/should_display.js | @@ -5,7 +5,7 @@ import {
unsubscribe,
isStream
} from "ember-metal/streams/utils";
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
import { get } from "ember-metal/property_get";
import { isArray } from "ember-metal/utils";
| true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-views/lib/system/render_buffer.js | @@ -5,7 +5,7 @@
import jQuery from "ember-views/system/jquery";
import Ember from "ember-metal/core";
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
import environment from "ember-metal/environment";
import { normalizeProperty } from "morph/dom-helper/prop";
| true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-views/lib/system/renderer.js | @@ -1,6 +1,6 @@
import Ember from "ember-metal/core";
import Renderer from 'ember-metal-views/renderer';
-import { create } from 'ember-metal/platform';
+import create from 'ember-metal/platform/create';
import RenderBuffer from "ember-views/system/render_buffer";
import run from "ember-metal/run_loop";
import { set } from "ember-metal/property_set"; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-views/lib/views/states.js | @@ -1,4 +1,4 @@
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
import merge from "ember-metal/merge";
import _default from "ember-views/views/states/default";
import preRender from "ember-views/views/states/pre_render"; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-views/lib/views/states/destroying.js | @@ -1,5 +1,5 @@
import merge from "ember-metal/merge";
-import {create} from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
import {fmt} from "ember-runtime/system/string";
import _default from "ember-views/views/states/default";
import EmberError from "ember-metal/error"; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-views/lib/views/states/has_element.js | @@ -1,7 +1,7 @@
import _default from "ember-views/views/states/default";
import run from "ember-metal/run_loop";
import merge from "ember-metal/merge";
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
import jQuery from "ember-views/system/jquery";
import EmberError from "ember-metal/error";
| true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-views/lib/views/states/in_buffer.js | @@ -2,7 +2,7 @@ import _default from "ember-views/views/states/default";
import EmberError from "ember-metal/error";
import jQuery from "ember-views/system/jquery";
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
import merge from "ember-metal/merge";
/** | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-views/lib/views/states/in_dom.js | @@ -1,5 +1,5 @@
import Ember from "ember-metal/core"; // Ember.assert
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
import merge from "ember-metal/merge";
import EmberError from "ember-metal/error";
import { addBeforeObserver } from 'ember-metal/observer'; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-views/lib/views/states/pre_render.js | @@ -1,5 +1,5 @@
import _default from "ember-views/views/states/default";
-import { create } from "ember-metal/platform";
+import create from 'ember-metal/platform/create';
/**
@module ember | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-views/lib/views/view.js | @@ -3,7 +3,7 @@
// Ember.ContainerView circular dependency
// Ember.ENV
import Ember from 'ember-metal/core';
-import { create } from 'ember-metal/platform';
+import create from 'ember-metal/platform/create';
import Evented from "ember-runtime/mixins/evented";
import EmberObject from "ember-runtime/system/object"; | true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember-views/tests/views/view/state_deprecation_test.js | @@ -1,4 +1,4 @@
-import { hasPropertyAccessors } from "ember-metal/platform";
+import { hasPropertyAccessors } from "ember-metal/platform/define_property";
import run from "ember-metal/run_loop";
import EmberView from "ember-views/views/view";
| true |
Other | emberjs | ember.js | a5d91490cd1ef0e99da06ee61fbb7e1c423b14b8.json | Avoid re-exports from ember-metal/platform. | packages/ember/tests/routing/query_params_test.js | @@ -1,6 +1,6 @@
import "ember";
import { computed } from "ember-metal/computed";
-import { canDefineNonEnumerableProperties } from 'ember-metal/platform';
+import { canDefineNonEnumerableProperties } from 'ember-metal/platform/define_property';
import { capitalize } from "ember-runtime/system/string";
import EmberHandlebars from "ember-htmlbars/compat"; | true |
Other | emberjs | ember.js | d422f83bc054cc39b9ceb009a08ac1ff2aecbe4a.json | Use imports instead of globals. | packages/ember-metal/lib/expand_properties.js | @@ -1,6 +1,6 @@
-import Ember from "ember-metal/core";
import EmberError from 'ember-metal/error';
import { forEach } from 'ember-metal/enumerable_utils';
+import { typeOf } from 'ember-metal/utils';
/**
@module ember-metal
@@ -40,7 +40,7 @@ export default function expandProperties(pattern, callback) {
'e.g. `user.{firstName, lastName}` should be `user.{firstName,lastName}`');
}
- if ('string' === Ember.typeOf(pattern)) {
+ if ('string' === typeOf(pattern)) {
var parts = pattern.split(SPLIT_REGEX);
var properties = [parts];
| true |
Other | emberjs | ember.js | d422f83bc054cc39b9ceb009a08ac1ff2aecbe4a.json | Use imports instead of globals. | packages/ember-runtime/lib/mixins/controller.js | @@ -1,5 +1,5 @@
import { Mixin } from "ember-metal/mixin";
-import { computed } from "ember-metal/computed";
+import alias from 'ember-metal/alias';
import ActionHandler from "ember-runtime/mixins/action_handler";
import ControllerContentModelAliasDeprecation from "ember-runtime/mixins/controller_content_model_alias_deprecation";
@@ -54,7 +54,7 @@ export default Mixin.create(ActionHandler, ControllerContentModelAliasDeprecatio
/**
@private
*/
- content: computed.alias('model')
+ content: alias('model')
});
| true |
Other | emberjs | ember.js | d422f83bc054cc39b9ceb009a08ac1ff2aecbe4a.json | Use imports instead of globals. | packages/ember-runtime/lib/system/core_object.js | @@ -8,7 +8,9 @@
@submodule ember-runtime
*/
-import Ember from "ember-metal/core";
+// using ember-metal/lib/main here to ensure that ember-debug is setup
+// if present
+import Ember from "ember-metal";
import merge from "ember-metal/merge";
// Ember.assert, Ember.config
| true |
Other | emberjs | ember.js | d422f83bc054cc39b9ceb009a08ac1ff2aecbe4a.json | Use imports instead of globals. | packages/ember-views/lib/views/bound_component_view.js | @@ -8,8 +8,9 @@ import { read, chain, subscribe, unsubscribe } from "ember-metal/streams/utils";
import { readComponentFactory } from "ember-views/streams/utils";
import mergeViewBindings from "ember-htmlbars/system/merge-view-bindings";
import EmberError from "ember-metal/error";
+import ContainerView from "ember-views/views/container_view";
-export default Ember.ContainerView.extend(_Metamorph, {
+export default ContainerView.extend(_Metamorph, {
init: function() {
this._super();
var componentNameStream = this._boundComponentOptions.componentNameStream; | true |
Other | emberjs | ember.js | e626f4a7e8d7f662f229c0a42794b3cba4f60d59.json | Remove trailing spaces | packages/ember-runtime/lib/system/core_object.js | @@ -795,7 +795,7 @@ var ClassMixinProps = {
```
This will return the original hash that was passed to `meta()`.
-
+
@static
@method metaForProperty
@param key {String} property name
@@ -831,7 +831,7 @@ var ClassMixinProps = {
/**
Iterate over each computed property for the class, passing its name
and any associated metadata (see `metaForProperty`) to the callback.
-
+
@static
@method eachComputedProperty
@param {Function} callback | false |
Other | emberjs | ember.js | dd9a0a4e0b68e36b1bac39ca3b98f29f2d6b7c0a.json | Fix accidental overriding of imports. | packages/ember-htmlbars/tests/helpers/log_test.js | @@ -3,7 +3,7 @@ import EmberView from 'ember-views/views/view';
import compile from 'ember-template-compiler/system/compile';
import { runAppend, runDestroy } from "ember-runtime/tests/utils";
-var originalLookup, originalLog, logCalls, lookup, view, compile;
+var originalLookup, originalLog, logCalls, lookup, view;
QUnit.module('ember-htmlbars: {{#log}} helper', {
setup: function() { | true |
Other | emberjs | ember.js | dd9a0a4e0b68e36b1bac39ca3b98f29f2d6b7c0a.json | Fix accidental overriding of imports. | packages/ember-htmlbars/tests/integration/binding_integration_test.js | @@ -11,7 +11,7 @@ import { registerHelper } from "ember-htmlbars/helpers";
import { set } from 'ember-metal/property_set';
-var compile, view, MyApp, originalLookup, lookup;
+var view, MyApp, originalLookup, lookup;
var trim = jQuery.trim;
| true |
Other | emberjs | ember.js | dd9a0a4e0b68e36b1bac39ca3b98f29f2d6b7c0a.json | Fix accidental overriding of imports. | packages/ember-htmlbars/tests/integration/escape_integration_test.js | @@ -6,7 +6,7 @@ import { set } from 'ember-metal/property_set';
import { create as o_create } from 'ember-metal/platform';
import { runAppend, runDestroy } from "ember-runtime/tests/utils";
-var compile, view;
+var view;
QUnit.module('ember-htmlbars: Integration with Globals', {
teardown: function() { | true |
Other | emberjs | ember.js | dd9a0a4e0b68e36b1bac39ca3b98f29f2d6b7c0a.json | Fix accidental overriding of imports. | packages/ember-htmlbars/tests/integration/globals_integration_test.js | @@ -3,7 +3,7 @@ import EmberView from 'ember-views/views/view';
import compile from 'ember-template-compiler/system/compile';
import { runAppend, runDestroy } from "ember-runtime/tests/utils";
-var compile, view, originalLookup, lookup;
+var view, originalLookup, lookup;
var originalLookup = Ember.lookup;
| true |
Other | emberjs | ember.js | e929b74d2c0768c8d1842bd0d31cf21ebad604b1.json | Pass arguments to _super | packages/ember-application/lib/system/application-instance.js | @@ -69,7 +69,7 @@ export default EmberObject.extend({
rootElement: null,
init: function() {
- this._super();
+ this._super.apply(this, arguments);
this.container = this.registry.container();
},
| false |
Other | emberjs | ember.js | a16adec23db8fcde1d8240815159f5609594512d.json | Add documentation to ApplicationInstance props
Thanks @stefanpenner! | packages/ember-application/lib/system/application-instance.js | @@ -29,28 +29,72 @@ import run from "ember-metal/run_loop";
*/
export default EmberObject.extend({
+ /**
+ The application instance's container. The container stores all of the
+ instance-specific state for this application run.
+
+ @property {Ember.Container} container
+ */
+ container: null,
+
+ /**
+ The application's registry. The registry contains the classes, templates,
+ and other code that makes up the application.
+
+ @property {Ember.Registry} registry
+ */
registry: null,
+
+ /**
+ The DOM events for which the event dispatcher should listen.
+
+ By default, the application's `Ember.EventDispatcher` listens
+ for a set of standard DOM events, such as `mousedown` and
+ `keyup`, and delegates them to your application's `Ember.View`
+ instances.
+
+ @private
+ @property {Object} customEvents
+ */
customEvents: null,
+
+ /**
+ The root DOM element of the Application as an element or a
+ [jQuery-compatible selector
+ string](http://api.jquery.com/category/selectors/).
+
+ @private
+ @property {String|DOMElement} rootElement
+ */
rootElement: null,
init: function() {
this._super();
this.container = this.registry.container();
},
+ /**
+ @private
+ */
startRouting: function(isModuleBasedResolver) {
var router = this.container.lookup('router:main');
if (!router) { return; }
router.startRouting(isModuleBasedResolver);
},
+ /**
+ @private
+ */
handleURL: function(url) {
var router = this.container.lookup('router:main');
return router.handleURL(url);
},
+ /**
+ @private
+ */
setupEventDispatcher: function() {
var dispatcher = this.container.lookup('event_dispatcher:main');
@@ -59,6 +103,9 @@ export default EmberObject.extend({
return dispatcher;
},
+ /**
+ @private
+ */
willDestroy: function() {
this._super.apply(this, arguments);
run(this.container, 'destroy'); | false |
Other | emberjs | ember.js | 496dfe7e92d7696d60594b077088232486fe3be8.json | Add tests for arrays of `before` and `after` | packages/ember-application/tests/system/initializers_test.js | @@ -114,6 +114,69 @@ test("initializers can be registered in a specified order", function() {
deepEqual(order, ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']);
});
+test("initializers can be registered in a specified order as an array", function() {
+ var order = [];
+ var MyApplication = Application.extend();
+
+
+ MyApplication.initializer({
+ name: 'third',
+ initialize: function(registry) {
+ order.push('third');
+ }
+ });
+
+ MyApplication.initializer({
+ name: 'second',
+ after: 'first',
+ before: ['third', 'fourth'],
+ initialize: function(registry) {
+ order.push('second');
+ }
+ });
+
+ MyApplication.initializer({
+ name: 'fourth',
+ after: ['second', 'third'],
+ initialize: function(registry) {
+ order.push('fourth');
+ }
+ });
+
+ MyApplication.initializer({
+ name: 'fifth',
+ after: 'fourth',
+ before: 'sixth',
+ initialize: function(registry) {
+ order.push('fifth');
+ }
+ });
+
+ MyApplication.initializer({
+ name: 'first',
+ before: ['second'],
+ initialize: function(registry) {
+ order.push('first');
+ }
+ });
+
+ MyApplication.initializer({
+ name: 'sixth',
+ initialize: function(registry) {
+ order.push('sixth');
+ }
+ });
+
+ run(function() {
+ app = MyApplication.create({
+ router: false,
+ rootElement: '#qunit-fixture'
+ });
+ });
+
+ deepEqual(order, ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']);
+});
+
test("initializers can have multiple dependencies", function () {
var order = [];
var a = { | true |
Other | emberjs | ember.js | 496dfe7e92d7696d60594b077088232486fe3be8.json | Add tests for arrays of `before` and `after` | packages/ember-application/tests/system/instance_initializers_test.js | @@ -114,6 +114,69 @@ if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) {
deepEqual(order, ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']);
});
+ test("initializers can be registered in a specified order as an array", function() {
+ var order = [];
+ var MyApplication = Application.extend();
+
+
+ MyApplication.instanceInitializer({
+ name: 'third',
+ initialize: function(registry) {
+ order.push('third');
+ }
+ });
+
+ MyApplication.instanceInitializer({
+ name: 'second',
+ after: 'first',
+ before: ['third', 'fourth'],
+ initialize: function(registry) {
+ order.push('second');
+ }
+ });
+
+ MyApplication.instanceInitializer({
+ name: 'fourth',
+ after: ['second', 'third'],
+ initialize: function(registry) {
+ order.push('fourth');
+ }
+ });
+
+ MyApplication.instanceInitializer({
+ name: 'fifth',
+ after: 'fourth',
+ before: 'sixth',
+ initialize: function(registry) {
+ order.push('fifth');
+ }
+ });
+
+ MyApplication.instanceInitializer({
+ name: 'first',
+ before: ['second'],
+ initialize: function(registry) {
+ order.push('first');
+ }
+ });
+
+ MyApplication.instanceInitializer({
+ name: 'sixth',
+ initialize: function(registry) {
+ order.push('sixth');
+ }
+ });
+
+ run(function() {
+ app = MyApplication.create({
+ router: false,
+ rootElement: '#qunit-fixture'
+ });
+ });
+
+ deepEqual(order, ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']);
+ });
+
test("initializers can have multiple dependencies", function () {
var order = [];
var a = { | true |
Other | emberjs | ember.js | cf55da239ada16d04dd9d6e3e4a6391b6ff1f365.json | Introduce instance initializers
This commit introduces a new (feature flagged) API for adding
instance initializers.
Instance initializers differ from normal initializers in that they are
passed the app instance rather than a registry, and therefore can access
instances from the container in a safe way.
This design not only allows us to avoid expensive app setup for each
FastBoot request, it also minimizes the amount of work required
between acceptance test runs (once the testing infrastructure
is updated to take advantage of it).
This commit also removes a previously introduced deprecation that was
not behind a feature flag. That deprecation (when emitted with the
feature flag enabled) now points to a comprehensive deprecation guide. | FEATURES.md | @@ -5,6 +5,27 @@ for a detailed explanation.
## Feature Flags
+* `ember-application-instance-initializers`
+
+ Splits apart initializers into two phases:
+
+ * Boot-time Initializers that receive a registry, and use it to set up
+ code structures
+ * Instance Initializers that receive an application instance, and use
+ it to set up application state per run of the application.
+
+ In FastBoot, each request will have its own run of the application,
+ and will only need to run the instance initializers.
+
+ In the future, tests will also be able to use this differentiation to
+ run just the instance initializers per-test.
+
+ With this change, `App.initializer` becomes a "boot-time" initializer,
+ and issues a deprecation warning if instances are accessed.
+
+ Apps should migrate any initializers that require instances to the new
+ `App.instanceInitializer` API.
+
* `ember-application-initializer-context`
Sets the context of the initializer function to its object instead of the | true |
Other | emberjs | ember.js | cf55da239ada16d04dd9d6e3e4a6391b6ff1f365.json | Introduce instance initializers
This commit introduces a new (feature flagged) API for adding
instance initializers.
Instance initializers differ from normal initializers in that they are
passed the app instance rather than a registry, and therefore can access
instances from the container in a safe way.
This design not only allows us to avoid expensive app setup for each
FastBoot request, it also minimizes the amount of work required
between acceptance test runs (once the testing infrastructure
is updated to take advantage of it).
This commit also removes a previously introduced deprecation that was
not behind a feature flag. That deprecation (when emitted with the
feature flag enabled) now points to a comprehensive deprecation guide. | features.json | @@ -15,6 +15,7 @@
"ember-testing-checkbox-helpers": null,
"ember-metal-stream": null,
"ember-htmlbars-each-with-index": true,
+ "ember-application-instance-initializers": null,
"ember-application-initializer-context": null
},
"debugStatements": [ | true |
Other | emberjs | ember.js | cf55da239ada16d04dd9d6e3e4a6391b6ff1f365.json | Introduce instance initializers
This commit introduces a new (feature flagged) API for adding
instance initializers.
Instance initializers differ from normal initializers in that they are
passed the app instance rather than a registry, and therefore can access
instances from the container in a safe way.
This design not only allows us to avoid expensive app setup for each
FastBoot request, it also minimizes the amount of work required
between acceptance test runs (once the testing infrastructure
is updated to take advantage of it).
This commit also removes a previously introduced deprecation that was
not behind a feature flag. That deprecation (when emitted with the
feature flag enabled) now points to a comprehensive deprecation guide. | packages/container/lib/registry.js | @@ -136,13 +136,21 @@ Registry.prototype = {
lookup: function(fullName, options) {
Ember.assert('Create a container on the registry (with `registry.container()`) before calling `lookup`.', this._defaultContainer);
- Ember.deprecate('`lookup` should not be called on a Registry. Call `lookup` directly on an associated Container instead.');
+
+ if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) {
+ Ember.deprecate('`lookup` was called on a Registry. The `initializer` API no longer receives a container, and you should use an `instanceInitializer` to look up objects from the container.', { url: "http://emberjs.com/guides/deprecations#toc_deprecate-access-to-instances-in-initializers" });
+ }
+
return this._defaultContainer.lookup(fullName, options);
},
lookupFactory: function(fullName) {
Ember.assert('Create a container on the registry (with `registry.container()`) before calling `lookupFactory`.', this._defaultContainer);
- Ember.deprecate('`lookupFactory` should not be called on a Registry. Call `lookupFactory` directly on an associated Container instead.');
+
+ if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) {
+ Ember.deprecate('`lookupFactory` was called on a Registry. The `initializer` API no longer receives a container, and you should use an `instanceInitializer` to look up objects from the container.', { url: "http://emberjs.com/guides/deprecations#toc_deprecate-access-to-instances-in-initializers" });
+ }
+
return this._defaultContainer.lookupFactory(fullName);
},
| true |
Other | emberjs | ember.js | cf55da239ada16d04dd9d6e3e4a6391b6ff1f365.json | Introduce instance initializers
This commit introduces a new (feature flagged) API for adding
instance initializers.
Instance initializers differ from normal initializers in that they are
passed the app instance rather than a registry, and therefore can access
instances from the container in a safe way.
This design not only allows us to avoid expensive app setup for each
FastBoot request, it also minimizes the amount of work required
between acceptance test runs (once the testing infrastructure
is updated to take advantage of it).
This commit also removes a previously introduced deprecation that was
not behind a feature flag. That deprecation (when emitted with the
feature flag enabled) now points to a comprehensive deprecation guide. | packages/ember-application/lib/system/application.js | @@ -528,7 +528,9 @@ var Application = Namespace.extend(DeferredMixin, {
_initialize: function() {
if (this.isDestroyed) { return; }
- this.runInitializers();
+ this.runInitializers(this.__registry__);
+ this.runInstanceInitializers(this.__instance__);
+
runLoadHooks('application', this);
// At this point, any initializers or load hooks that would have wanted
@@ -627,12 +629,31 @@ var Application = Namespace.extend(DeferredMixin, {
@private
@method runInitializers
*/
- runInitializers: function() {
- var initializersByName = get(this.constructor, 'initializers');
+ runInitializers: function(registry) {
+ var App = this;
+ this._runInitializer('initializers', function(name, initializer) {
+ Ember.assert("No application initializer named '" + name + "'", !!initializer);
+
+ if (Ember.FEATURES.isEnabled("ember-application-initializer-context")) {
+ initializer.initialize(registry, App);
+ } else {
+ var ref = initializer.initialize;
+ ref(registry, App);
+ }
+ });
+ },
+
+ runInstanceInitializers: function(instance) {
+ this._runInitializer('instanceInitializers', function(name, initializer) {
+ Ember.assert("No instance initializer named '" + name + "'", !!initializer);
+ initializer.initialize(instance);
+ });
+ },
+
+ _runInitializer: function(bucketName, cb) {
+ var initializersByName = get(this.constructor, bucketName);
var initializers = props(initializersByName);
- var registry = this.__registry__;
var graph = new DAG();
- var namespace = this;
var initializer;
for (var i = 0; i < initializers.length; i++) {
@@ -641,15 +662,7 @@ var Application = Namespace.extend(DeferredMixin, {
}
graph.topsort(function (vertex) {
- var initializer = vertex.value;
- Ember.assert("No application initializer named '" + vertex.name + "'", !!initializer);
-
- if (Ember.FEATURES.isEnabled("ember-application-initializer-context")) {
- initializer.initialize(registry, namespace);
- } else {
- var ref = initializer.initialize;
- ref(registry, namespace);
- }
+ cb(vertex.name, vertex.value);
});
},
@@ -737,8 +750,21 @@ var Application = Namespace.extend(DeferredMixin, {
}
});
+if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) {
+ Application.reopen({
+ instanceInitializer: function(options) {
+ this.constructor.instanceInitializer(options);
+ }
+ });
+
+ Application.reopenClass({
+ instanceInitializer: buildInitializerMethod('instanceInitializers', 'instance initializer')
+ });
+}
+
Application.reopenClass({
initializers: create(null),
+ instanceInitializers: create(null),
/**
Initializer receives an object which has the following attributes:
@@ -863,23 +889,7 @@ Application.reopenClass({
@method initializer
@param initializer {Object}
*/
- initializer: function(initializer) {
- // If this is the first initializer being added to a subclass, we are going to reopen the class
- // to make sure we have a new `initializers` object, which extends from the parent class' using
- // prototypal inheritance. Without this, attempting to add initializers to the subclass would
- // pollute the parent class as well as other subclasses.
- if (this.superclass.initializers !== undefined && this.superclass.initializers === this.initializers) {
- this.reopenClass({
- initializers: create(this.initializers)
- });
- }
-
- Ember.assert("The initializer '" + initializer.name + "' has already been registered", !this.initializers[initializer.name]);
- Ember.assert("An initializer cannot be registered without an initialize function", canInvoke(initializer, 'initialize'));
- Ember.assert("An initializer cannot be registered without a name property", initializer.name !== undefined);
-
- this.initializers[initializer.name] = initializer;
- },
+ initializer: buildInitializerMethod('initializers', 'initializer'),
/**
This creates a registry with the default Ember naming conventions.
@@ -1046,4 +1056,24 @@ function logLibraryVersions() {
}
}
+function buildInitializerMethod(bucketName, humanName) {
+ return function(initializer) {
+ // If this is the first initializer being added to a subclass, we are going to reopen the class
+ // to make sure we have a new `initializers` object, which extends from the parent class' using
+ // prototypal inheritance. Without this, attempting to add initializers to the subclass would
+ // pollute the parent class as well as other subclasses.
+ if (this.superclass[bucketName] !== undefined && this.superclass[bucketName] === this[bucketName]) {
+ var attrs = {};
+ attrs[bucketName] = create(this[bucketName]);
+ this.reopenClass(attrs);
+ }
+
+ Ember.assert("The " + humanName + " '" + initializer.name + "' has already been registered", !this[bucketName][initializer.name]);
+ Ember.assert("An " + humanName + " cannot be registered without an initialize function", canInvoke(initializer, 'initialize'));
+ Ember.assert("An " + humanName + " cannot be registered without a name property", initializer.name !== undefined);
+
+ this[bucketName][initializer.name] = initializer;
+ };
+}
+
export default Application; | true |
Other | emberjs | ember.js | cf55da239ada16d04dd9d6e3e4a6391b6ff1f365.json | Introduce instance initializers
This commit introduces a new (feature flagged) API for adding
instance initializers.
Instance initializers differ from normal initializers in that they are
passed the app instance rather than a registry, and therefore can access
instances from the container in a safe way.
This design not only allows us to avoid expensive app setup for each
FastBoot request, it also minimizes the amount of work required
between acceptance test runs (once the testing infrastructure
is updated to take advantage of it).
This commit also removes a previously introduced deprecation that was
not behind a feature flag. That deprecation (when emitted with the
feature flag enabled) now points to a comprehensive deprecation guide. | packages/ember-application/tests/system/initializers_test.js | @@ -2,6 +2,7 @@ import run from "ember-metal/run_loop";
import Application from "ember-application/system/application";
import { indexOf } from "ember-metal/array";
import jQuery from "ember-views/system/jquery";
+import Registry from "container/registry";
var app;
@@ -33,6 +34,25 @@ test("initializers require proper 'name' and 'initialize' properties", function(
});
+test("initializers are passed a registry and App", function() {
+ var MyApplication = Application.extend();
+
+ MyApplication.initializer({
+ name: 'initializer',
+ initialize: function(registry, App) {
+ ok(registry instanceof Registry, "initialize is passed a registry");
+ ok(App instanceof Application, "initialize is passed an Application");
+ }
+ });
+
+ run(function() {
+ app = MyApplication.create({
+ router: false,
+ rootElement: '#qunit-fixture'
+ });
+ });
+});
+
test("initializers can be registered in a specified order", function() {
var order = [];
var MyApplication = Application.extend(); | true |
Other | emberjs | ember.js | cf55da239ada16d04dd9d6e3e4a6391b6ff1f365.json | Introduce instance initializers
This commit introduces a new (feature flagged) API for adding
instance initializers.
Instance initializers differ from normal initializers in that they are
passed the app instance rather than a registry, and therefore can access
instances from the container in a safe way.
This design not only allows us to avoid expensive app setup for each
FastBoot request, it also minimizes the amount of work required
between acceptance test runs (once the testing infrastructure
is updated to take advantage of it).
This commit also removes a previously introduced deprecation that was
not behind a feature flag. That deprecation (when emitted with the
feature flag enabled) now points to a comprehensive deprecation guide. | packages/ember-application/tests/system/instance_initializers_test.js | @@ -0,0 +1,284 @@
+import run from "ember-metal/run_loop";
+import Application from "ember-application/system/application";
+import ApplicationInstance from "ember-application/system/application-instance";
+import { indexOf } from "ember-metal/array";
+import jQuery from "ember-views/system/jquery";
+
+var app;
+
+if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) {
+ QUnit.module("Ember.Application instance initializers", {
+ setup: function() {
+ },
+
+ teardown: function() {
+ if (app) {
+ run(function() { app.destroy(); });
+ }
+ }
+ });
+
+ test("initializers require proper 'name' and 'initialize' properties", function() {
+ var MyApplication = Application.extend();
+
+ expectAssertion(function() {
+ run(function() {
+ MyApplication.instanceInitializer({ name: 'initializer' });
+ });
+ });
+
+ expectAssertion(function() {
+ run(function() {
+ MyApplication.instanceInitializer({ initialize: Ember.K });
+ });
+ });
+
+ });
+
+ test("initializers are passed an app instance", function() {
+ var MyApplication = Application.extend();
+
+ MyApplication.instanceInitializer({
+ name: 'initializer',
+ initialize: function(instance) {
+ ok(instance instanceof ApplicationInstance, "initialize is passed an application instance");
+ }
+ });
+
+ run(function() {
+ app = MyApplication.create({
+ router: false,
+ rootElement: '#qunit-fixture'
+ });
+ });
+ });
+
+ test("initializers can be registered in a specified order", function() {
+ var order = [];
+ var MyApplication = Application.extend();
+ MyApplication.instanceInitializer({
+ name: 'fourth',
+ after: 'third',
+ initialize: function(registry) {
+ order.push('fourth');
+ }
+ });
+
+ MyApplication.instanceInitializer({
+ name: 'second',
+ after: 'first',
+ before: 'third',
+ initialize: function(registry) {
+ order.push('second');
+ }
+ });
+
+ MyApplication.instanceInitializer({
+ name: 'fifth',
+ after: 'fourth',
+ before: 'sixth',
+ initialize: function(registry) {
+ order.push('fifth');
+ }
+ });
+
+ MyApplication.instanceInitializer({
+ name: 'first',
+ before: 'second',
+ initialize: function(registry) {
+ order.push('first');
+ }
+ });
+
+ MyApplication.instanceInitializer({
+ name: 'third',
+ initialize: function(registry) {
+ order.push('third');
+ }
+ });
+
+ MyApplication.instanceInitializer({
+ name: 'sixth',
+ initialize: function(registry) {
+ order.push('sixth');
+ }
+ });
+
+ run(function() {
+ app = MyApplication.create({
+ router: false,
+ rootElement: '#qunit-fixture'
+ });
+ });
+
+ deepEqual(order, ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']);
+ });
+
+ test("initializers can have multiple dependencies", function () {
+ var order = [];
+ var a = {
+ name: "a",
+ before: "b",
+ initialize: function(registry) {
+ order.push('a');
+ }
+ };
+ var b = {
+ name: "b",
+ initialize: function(registry) {
+ order.push('b');
+ }
+ };
+ var c = {
+ name: "c",
+ after: "b",
+ initialize: function(registry) {
+ order.push('c');
+ }
+ };
+ var afterB = {
+ name: "after b",
+ after: "b",
+ initialize: function(registry) {
+ order.push("after b");
+ }
+ };
+ var afterC = {
+ name: "after c",
+ after: "c",
+ initialize: function(registry) {
+ order.push("after c");
+ }
+ };
+
+ Application.instanceInitializer(b);
+ Application.instanceInitializer(a);
+ Application.instanceInitializer(afterC);
+ Application.instanceInitializer(afterB);
+ Application.instanceInitializer(c);
+
+ run(function() {
+ app = Application.create({
+ router: false,
+ rootElement: '#qunit-fixture'
+ });
+ });
+
+ ok(indexOf.call(order, a.name) < indexOf.call(order, b.name), 'a < b');
+ ok(indexOf.call(order, b.name) < indexOf.call(order, c.name), 'b < c');
+ ok(indexOf.call(order, b.name) < indexOf.call(order, afterB.name), 'b < afterB');
+ ok(indexOf.call(order, c.name) < indexOf.call(order, afterC.name), 'c < afterC');
+ });
+
+ test("initializers set on Application subclasses should not be shared between apps", function() {
+ var firstInitializerRunCount = 0;
+ var secondInitializerRunCount = 0;
+ var FirstApp = Application.extend();
+ FirstApp.instanceInitializer({
+ name: 'first',
+ initialize: function(registry) {
+ firstInitializerRunCount++;
+ }
+ });
+ var SecondApp = Application.extend();
+ SecondApp.instanceInitializer({
+ name: 'second',
+ initialize: function(registry) {
+ secondInitializerRunCount++;
+ }
+ });
+ jQuery('#qunit-fixture').html('<div id="first"></div><div id="second"></div>');
+ run(function() {
+ FirstApp.create({
+ router: false,
+ rootElement: '#qunit-fixture #first'
+ });
+ });
+ equal(firstInitializerRunCount, 1, 'first initializer only was run');
+ equal(secondInitializerRunCount, 0, 'first initializer only was run');
+ run(function() {
+ SecondApp.create({
+ router: false,
+ rootElement: '#qunit-fixture #second'
+ });
+ });
+ equal(firstInitializerRunCount, 1, 'second initializer only was run');
+ equal(secondInitializerRunCount, 1, 'second initializer only was run');
+ });
+
+ test("initializers are concatenated", function() {
+ var firstInitializerRunCount = 0;
+ var secondInitializerRunCount = 0;
+ var FirstApp = Application.extend();
+ FirstApp.instanceInitializer({
+ name: 'first',
+ initialize: function(registry) {
+ firstInitializerRunCount++;
+ }
+ });
+
+ var SecondApp = FirstApp.extend();
+ SecondApp.instanceInitializer({
+ name: 'second',
+ initialize: function(registry) {
+ secondInitializerRunCount++;
+ }
+ });
+
+ jQuery('#qunit-fixture').html('<div id="first"></div><div id="second"></div>');
+ run(function() {
+ FirstApp.create({
+ router: false,
+ rootElement: '#qunit-fixture #first'
+ });
+ });
+ equal(firstInitializerRunCount, 1, 'first initializer only was run when base class created');
+ equal(secondInitializerRunCount, 0, 'first initializer only was run when base class created');
+ firstInitializerRunCount = 0;
+ run(function() {
+ SecondApp.create({
+ router: false,
+ rootElement: '#qunit-fixture #second'
+ });
+ });
+ equal(firstInitializerRunCount, 1, 'first initializer was run when subclass created');
+ equal(secondInitializerRunCount, 1, 'second initializers was run when subclass created');
+ });
+
+ test("initializers are per-app", function() {
+ expect(0);
+ var FirstApp = Application.extend();
+ FirstApp.instanceInitializer({
+ name: 'shouldNotCollide',
+ initialize: function(registry) {}
+ });
+
+ var SecondApp = Application.extend();
+ SecondApp.instanceInitializer({
+ name: 'shouldNotCollide',
+ initialize: function(registry) {}
+ });
+ });
+
+ if (Ember.FEATURES.isEnabled("ember-application-initializer-context")) {
+ test("initializers should be executed in their own context", function() {
+ expect(1);
+ var MyApplication = Application.extend();
+
+ MyApplication.instanceInitializer({
+ name: 'coolBabeInitializer',
+ myProperty: 'coolBabe',
+ initialize: function(registry, application) {
+ equal(this.myProperty, 'coolBabe', 'should have access to its own context');
+ }
+ });
+
+ run(function() {
+ app = MyApplication.create({
+ router: false,
+ rootElement: '#qunit-fixture'
+ });
+ });
+ });
+ }
+} | true |
Other | emberjs | ember.js | 9c2b8d4166d67774d5565834cd2622dd6d2b0b95.json | Extract ApplicationInstance to separate file | packages/ember-application/lib/system/application-instance.js | @@ -0,0 +1,38 @@
+/**
+@module ember
+@submodule ember-application
+*/
+
+import EmberObject from "ember-runtime/system/object";
+import run from "ember-metal/run_loop";
+
+export default EmberObject.extend({
+ container: null,
+ customEvents: null,
+ rootElement: null,
+
+ startRouting: function(isModuleBasedResolver) {
+ var router = this.container.lookup('router:main');
+ if (!router) { return; }
+
+ router.startRouting(isModuleBasedResolver);
+ },
+
+ handleURL: function(url) {
+ var router = this.container.lookup('router:main');
+
+ return router.handleURL(url);
+ },
+
+ setupEventDispatcher: function() {
+ var dispatcher = this.container.lookup('event_dispatcher:main');
+
+ dispatcher.setup(this.customEvents, this.rootElement);
+
+ return dispatcher;
+ },
+
+ willDestroy: function() {
+ run(this.container, 'destroy');
+ }
+}); | true |
Other | emberjs | ember.js | 9c2b8d4166d67774d5565834cd2622dd6d2b0b95.json | Extract ApplicationInstance to separate file | packages/ember-application/lib/system/application.js | @@ -31,6 +31,7 @@ import HistoryLocation from "ember-routing/location/history_location";
import AutoLocation from "ember-routing/location/auto_location";
import NoneLocation from "ember-routing/location/none_location";
import BucketCache from "ember-routing/system/cache";
+import ApplicationInstance from "ember-application/system/application-instance";
import ContainerDebugAdapter from "ember-extension-support/container_debug_adapter";
@@ -1043,35 +1044,4 @@ function logLibraryVersions() {
}
}
-var ApplicationInstance = Ember.Object.extend({
- container: null,
- customEvents: null,
- rootElement: null,
-
- startRouting: function(isModuleBasedResolver) {
- var router = this.container.lookup('router:main');
- if (!router) { return; }
-
- router.startRouting(isModuleBasedResolver);
- },
-
- handleURL: function(url) {
- var router = this.container.lookup('router:main');
-
- return router.handleURL(url);
- },
-
- setupEventDispatcher: function() {
- var dispatcher = this.container.lookup('event_dispatcher:main');
-
- dispatcher.setup(this.customEvents, this.rootElement);
-
- return dispatcher;
- },
-
- willDestroy: function() {
- run(this.container, 'destroy');
- }
-});
-
export default Application; | true |
Other | emberjs | ember.js | 0941344b7cdc87046551b48be758d4aa1a6f7239.json | Store an ApplicationInstance on the Application
Instead of storing a `__container__` on the Application, this commit
stores an ApplicationInstance, which manages the per-instance lifecycle.
The next step will be allowing multiple `ApplicationInstance`s to exist
at once, enabling a single app to serve multiple FastBoot requests at a
time.
This is a conceptual improvement that brings application “reset” in line
with the destruction infrastructure.
As part of this commit, we eliminated an ad-hoc call to router.reset(),
allowing that logic to happen as a natural consequence of destruction
of the `ApplicationInstance`.
In general, the goal of this commit is to move all responsibility for
application state into an object that manages it. | packages/ember-application/lib/system/application.js | @@ -270,7 +270,7 @@ var Application = Namespace.extend(DeferredMixin, {
this.buildRegistry();
// TODO:(tomdale+wycats) Move to session creation phase
- this.buildContainer();
+ this.buildInstance();
registerLibraries();
logLibraryVersions();
@@ -295,13 +295,19 @@ var Application = Namespace.extend(DeferredMixin, {
Create a container for the current application's registry.
@private
- @method buildContainer
+ @method buildInstance
@return {Ember.Container} the configured container
*/
- buildContainer: function() {
+ buildInstance: function() {
var container = this.__container__ = this.__registry__.container();
- return container;
+ var instance = this.__instance__ = ApplicationInstance.create({
+ customEvents: get(this, 'customEvents'),
+ rootElement: get(this, 'rootElement'),
+ container: container
+ });
+
+ return instance;
},
/**
@@ -599,15 +605,14 @@ var Application = Namespace.extend(DeferredMixin, {
@method reset
**/
reset: function() {
+ var instance = this.__instance__;
+
this._readinessDeferrals = 1;
function handleReset() {
- var router = this.__container__.lookup('router:main');
- router.reset();
+ run(instance, 'destroy');
- run(this.__container__, 'destroy');
-
- this.buildContainer();
+ this.buildInstance();
run.schedule('actions', this, '_initialize');
}
@@ -651,7 +656,7 @@ var Application = Namespace.extend(DeferredMixin, {
*/
didBecomeReady: function() {
if (environment.hasDOM) {
- this.setupEventDispatcher();
+ this.__instance__.setupEventDispatcher();
}
this.ready(); // user hook
@@ -666,23 +671,6 @@ var Application = Namespace.extend(DeferredMixin, {
this.resolve(this);
},
- /**
- Setup up the event dispatcher to receive events on the
- application's `rootElement` with any registered
- `customEvents`.
-
- @private
- @method setupEventDispatcher
- */
- setupEventDispatcher: function() {
- var customEvents = get(this, 'customEvents');
- var rootElement = get(this, 'rootElement');
- var dispatcher = this.__container__.lookup('event_dispatcher:main');
-
- set(this, 'eventDispatcher', dispatcher);
- dispatcher.setup(customEvents, rootElement);
- },
-
/**
If the application has a router, use it to route to the current URL, and
trigger a new call to `route` whenever the URL changes.
@@ -692,18 +680,12 @@ var Application = Namespace.extend(DeferredMixin, {
@property router {Ember.Router}
*/
startRouting: function() {
- var router = this.__container__.lookup('router:main');
- if (!router) { return; }
-
- var moduleBasedResolver = this.Resolver && this.Resolver.moduleBasedResolver;
-
- router.startRouting(moduleBasedResolver);
+ var isModuleBasedResolver = this.Resolver && this.Resolver.moduleBasedResolver;
+ this.__instance__.startRouting(isModuleBasedResolver);
},
handleURL: function(url) {
- var router = this.__container__.lookup('router:main');
-
- router.handleURL(url);
+ return this.__instance__.handleURL(url);
},
/**
@@ -730,12 +712,10 @@ var Application = Namespace.extend(DeferredMixin, {
*/
Resolver: null,
+ // This method must be moved to the application instance object
willDestroy: function() {
Ember.BOOTED = false;
- // Ensure deactivation of routes before objects are destroyed
- this.__container__.lookup('router:main').reset();
-
- this.__container__.destroy();
+ this.__instance__.destroy();
},
initializer: function(options) {
@@ -1063,4 +1043,35 @@ function logLibraryVersions() {
}
}
+var ApplicationInstance = Ember.Object.extend({
+ container: null,
+ customEvents: null,
+ rootElement: null,
+
+ startRouting: function(isModuleBasedResolver) {
+ var router = this.container.lookup('router:main');
+ if (!router) { return; }
+
+ router.startRouting(isModuleBasedResolver);
+ },
+
+ handleURL: function(url) {
+ var router = this.container.lookup('router:main');
+
+ return router.handleURL(url);
+ },
+
+ setupEventDispatcher: function() {
+ var dispatcher = this.container.lookup('event_dispatcher:main');
+
+ dispatcher.setup(this.customEvents, this.rootElement);
+
+ return dispatcher;
+ },
+
+ willDestroy: function() {
+ run(this.container, 'destroy');
+ }
+});
+
export default Application; | true |
Other | emberjs | ember.js | 0941344b7cdc87046551b48be758d4aa1a6f7239.json | Store an ApplicationInstance on the Application
Instead of storing a `__container__` on the Application, this commit
stores an ApplicationInstance, which manages the per-instance lifecycle.
The next step will be allowing multiple `ApplicationInstance`s to exist
at once, enabling a single app to serve multiple FastBoot requests at a
time.
This is a conceptual improvement that brings application “reset” in line
with the destruction infrastructure.
As part of this commit, we eliminated an ad-hoc call to router.reset(),
allowing that logic to happen as a natural consequence of destruction
of the `ApplicationInstance`.
In general, the goal of this commit is to move all responsibility for
application state into an object that manages it. | packages/ember-routing/lib/system/router.js | @@ -297,6 +297,10 @@ var EmberRouter = EmberObject.extend(Evented, {
}
},
+ willDestroy: function() {
+ this.reset();
+ },
+
_lookupActiveView: function(templateName) {
var active = this._activeViews[templateName];
return active && active[0]; | true |
Other | emberjs | ember.js | e4392eb84f87504bf5748277dcc13c925ccd8ba1.json | Deprecate computed.any in favor of computed.or | packages/ember-metal/lib/computed_macros.js | @@ -478,6 +478,7 @@ registerComputedWithProperties('or', function(properties) {
@param {String} dependentKey*
@return {Ember.ComputedProperty} computed property which returns
the first truthy value of given list of properties.
+ @deprecated Use `Ember.computed.or` instead.
*/
registerComputedWithProperties('any', function(properties) {
for (var key in properties) { | false |
Other | emberjs | ember.js | 9d4e51af4e13325eea9ba15c2b173bf0ac7f4b47.json | Add example of new CP syntax in features.md
I've just wanted to enable the new CP syntax and when I looked the exact
FF name, I realized that a small code example would make the feature
much easier to understand. | FEATURES.md | @@ -142,6 +142,20 @@ for a detailed explanation.
Enables the new computed property syntax. In this new syntax, instead of passing
a function that acts both as getter and setter for the property, `Ember.computed`
receives an object with `get` and `set` keys, each one containing a function.
+
+ For example,
+
+ ```js
+ visible: Ember.computed('visibility', {
+ get: function(key) {
+ return this.get('visibility') !== 'hidden';
+ },
+ set: function(key, boolValue) {
+ this.set('visibility', boolValue ? 'visible' : 'hidden');
+ }
+ })
+ ```
+
If the object does not contain a `set` key, the property will simply be overridden.
Passing just function is still supported, and is equivalent to passing only a getter.
| false |
Other | emberjs | ember.js | b556fd7fbe2a6839cd3b7798654713b4036c48a1.json | Remove duplicate imports. | packages/ember-application/lib/ext/controller.js | @@ -6,10 +6,9 @@
import Ember from "ember-metal/core"; // Ember.assert
import { get } from "ember-metal/property_get";
import EmberError from "ember-metal/error";
-import { inspect } from "ember-metal/utils";
+import { inspect, meta } from "ember-metal/utils";
import { computed } from "ember-metal/computed";
import ControllerMixin from "ember-runtime/mixins/controller";
-import { meta } from "ember-metal/utils";
import controllerFor from "ember-routing/system/controller_for";
function verifyNeedsDependencies(controller, container, needs) { | true |
Other | emberjs | ember.js | b556fd7fbe2a6839cd3b7798654713b4036c48a1.json | Remove duplicate imports. | packages/ember-metal/lib/environment.js | @@ -1,3 +1,4 @@
+import Ember from 'ember-metal/core';
/*
Ember can run in many different environments, including environments like | true |
Other | emberjs | ember.js | b556fd7fbe2a6839cd3b7798654713b4036c48a1.json | Remove duplicate imports. | packages/ember-routing/lib/ext/controller.js | @@ -2,8 +2,7 @@ import Ember from "ember-metal/core"; // FEATURES, deprecate
import { get } from "ember-metal/property_get";
import { set } from "ember-metal/property_set";
import { computed } from "ember-metal/computed";
-import { typeOf } from "ember-metal/utils";
-import { meta } from "ember-metal/utils";
+import { typeOf, meta } from "ember-metal/utils";
import merge from "ember-metal/merge";
import ControllerMixin from "ember-runtime/mixins/controller"; | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.