dist/ember-runtime.js in ember-source-1.9.1 vs dist/ember-runtime.js in ember-source-1.10.0.beta.1
- old
+ new
@@ -3,11 +3,11 @@
* @copyright Copyright 2011-2014 Tilde Inc. and contributors
* Portions Copyright 2006-2011 Strobe Inc.
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
* @license Licensed under MIT license
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
- * @version 1.9.1
+ * @version 1.10.0-beta.1
*/
(function() {
var define, requireModule, require, requirejs, Ember;
@@ -30,11 +30,11 @@
if (s === UNDEFINED) { return undefined; }
seen[name] = {};
if (!registry[name]) {
- throw new Error("Could not find module " + name);
+ throw new Error('Could not find module ' + name);
}
var mod = registry[name];
var deps = mod.deps;
var callback = mod.callback;
@@ -54,28 +54,34 @@
return seen[name] = exports || (value === undefined ? UNDEFINED : value);
};
function resolve(child, name) {
- if (child.charAt(0) !== '.') { return child; }
- var parts = child.split("/");
- var parentBase = name.split("/").slice(0, -1);
+ if (child.charAt(0) !== '.') {
+ return child;
+ }
+ var parts = child.split('/');
+ var parentBase = name.split('/').slice(0, -1);
for (var i=0, l=parts.length; i<l; i++) {
var part = parts[i];
if (part === '..') { parentBase.pop(); }
else if (part === '.') { continue; }
else { parentBase.push(part); }
}
- return parentBase.join("/");
+ return parentBase.join('/');
}
requirejs._eak_seen = registry;
- Ember.__loader = {define: define, require: require, registry: registry};
+ Ember.__loader = {
+ define: define,
+ require: require,
+ registry: registry
+ };
} else {
define = Ember.__loader.define;
requirejs = require = requireModule = Ember.__loader.require;
}
})();
@@ -1116,10 +1122,13 @@
this.factoryCache = dictionary(parent ? parent.factoryCache : null);
this.resolveCache = dictionary(parent ? parent.resolveCache : null);
this.typeInjections = dictionary(parent ? parent.typeInjections : null);
this.injections = dictionary(null);
this.normalizeCache = dictionary(null);
+
+ this.validationCache = dictionary(parent ? parent.validationCache : null);
+
this.factoryTypeInjections = dictionary(parent ? parent.factoryTypeInjections : null);
this.factoryInjections = dictionary(null);
this._options = dictionary(parent ? parent._options : null);
@@ -1262,10 +1271,13 @@
delete this.registry[normalizedName];
delete this.cache[normalizedName];
delete this.factoryCache[normalizedName];
delete this.resolveCache[normalizedName];
delete this._options[normalizedName];
+
+ delete this.validationCache[normalizedName];
+
},
/**
Given a fullName return the corresponding factory.
@@ -1825,10 +1837,14 @@
var factory = container.resolve(fullName);
if (factory === undefined) { return; }
var type = fullName.split(':')[0];
if (!factory || typeof factory.extend !== 'function' || (!Ember.MODEL_FACTORY_INJECTIONS && type === 'model')) {
+ if (factory && typeof factory._onLookup === 'function') {
+ factory._onLookup(fullName);
+ }
+
// TODO: think about a 'safe' merge style extension
// for now just fallback to create time injection
cache[fullName] = factory;
return factory;
} else {
@@ -1838,10 +1854,14 @@
factoryInjections._toString = container.makeToString(factory, fullName);
var injectedFactory = factory.extend(injections);
injectedFactory.reopenClass(factoryInjections);
+ if (factory && typeof factory._onLookup === 'function') {
+ factory._onLookup(fullName);
+ }
+
cache[fullName] = injectedFactory;
return injectedFactory;
}
}
@@ -1889,11 +1909,11 @@
return injections;
}
function instantiate(container, fullName) {
var factory = factoryFor(container, fullName);
- var lazyInjections;
+ var lazyInjections, validationCache;
if (option(container, fullName, 'instantiate') === false) {
return factory;
}
@@ -1902,10 +1922,22 @@
throw new Error('Failed to create an instance of \'' + fullName + '\'. ' +
'Most likely an improperly defined class or an invalid module export.');
}
+ validationCache = container.validationCache;
+
+ // Ensure that all lazy injections are valid at instantiation time
+ if (!validationCache[fullName] && typeof factory._lazyInjections === 'function') {
+ lazyInjections = factory._lazyInjections();
+
+ validateInjections(container, normalizeInjectionsHash(lazyInjections));
+ }
+
+ validationCache[fullName] = true;
+
+
if (typeof factory.extend === 'function') {
// assume the factory was extendable and is already injected
return factory.create();
} else {
// assume the factory was extendable
@@ -2027,15 +2059,14 @@
var _getPath = __dependency11__._getPath;
var get = __dependency11__.get;
var getWithDefault = __dependency11__.getWithDefault;
var normalizeTuple = __dependency11__.normalizeTuple;
+ var accumulateListeners = __dependency12__.accumulateListeners;
var addListener = __dependency12__.addListener;
var hasListeners = __dependency12__.hasListeners;
- var listenersDiff = __dependency12__.listenersDiff;
var listenersFor = __dependency12__.listenersFor;
- var listenersUnion = __dependency12__.listenersUnion;
var on = __dependency12__.on;
var removeListener = __dependency12__.removeListener;
var sendEvent = __dependency12__.sendEvent;
var suspendListener = __dependency12__.suspendListener;
var suspendListeners = __dependency12__.suspendListeners;
@@ -2101,11 +2132,11 @@
var Binding = __dependency29__.Binding;
var bind = __dependency29__.bind;
var isGlobalPath = __dependency29__.isGlobalPath;
var oneWay = __dependency29__.oneWay;
var run = __dependency30__["default"];
- var libraries = __dependency31__["default"];
+ var Libraries = __dependency31__["default"];
var isNone = __dependency32__["default"];
var isEmpty = __dependency33__["default"];
var isBlank = __dependency34__["default"];
var isPresent = __dependency35__["default"];
var keys = __dependency36__["default"];
@@ -2168,21 +2199,20 @@
Ember.normalizeTuple = normalizeTuple;
Ember._getPath = _getPath;
Ember.EnumerableUtils = EnumerableUtils;
- Ember.on = on;
- Ember.addListener = addListener;
- Ember.removeListener = removeListener;
- Ember._suspendListener = suspendListener;
- Ember._suspendListeners = suspendListeners;
- Ember.sendEvent = sendEvent;
- Ember.hasListeners = hasListeners;
- Ember.watchedEvents = watchedEvents;
- Ember.listenersFor = listenersFor;
- Ember.listenersDiff = listenersDiff;
- Ember.listenersUnion = listenersUnion;
+ Ember.on = on;
+ Ember.addListener = addListener;
+ Ember.removeListener = removeListener;
+ Ember._suspendListener = suspendListener;
+ Ember._suspendListeners = suspendListeners;
+ Ember.sendEvent = sendEvent;
+ Ember.hasListeners = hasListeners;
+ Ember.watchedEvents = watchedEvents;
+ Ember.listenersFor = listenersFor;
+ Ember.accumulateListeners = accumulateListeners;
Ember._ObserverSet = ObserverSet;
Ember.propertyWillChange = propertyWillChange;
Ember.propertyDidChange = propertyDidChange;
@@ -2252,11 +2282,11 @@
Ember.Binding = Binding;
Ember.isGlobalPath = isGlobalPath;
Ember.run = run;
- Ember.libraries = libraries;
+ Ember.libraries = new Libraries();
Ember.libraries.registerCoreLibrary('Ember', Ember.VERSION);
Ember.isNone = isNone;
Ember.isEmpty = isEmpty;
Ember.isBlank = isBlank;
@@ -3482,13 +3512,10 @@
/**
@module ember-metal
*/
- Ember.warn("The CP_DEFAULT_CACHEABLE flag has been removed and computed properties" +
- "are always cached by default. Use `volatile` if you don't want caching.", Ember.ENV.CP_DEFAULT_CACHEABLE !== false);
-
var metaFor = meta;
var a_slice = [].slice;
function UNDEFINED() { }
@@ -3583,13 +3610,15 @@
this._dependentKeys = undefined;
this._suspended = undefined;
this._meta = undefined;
- this._cacheable = (opts && opts.cacheable !== undefined) ? opts.cacheable : true;
+ Ember.deprecate("Passing opts.cacheable to the CP constructor is deprecated. Invoke `volatile()` on the CP instead.", !opts || !opts.hasOwnProperty('cacheable'));
+ this._cacheable = (opts && opts.cacheable !== undefined) ? opts.cacheable : true; // TODO: Set always to `true` once this deprecation is gone.
this._dependentKeys = opts && opts.dependentKeys;
- this._readOnly = opts && (opts.readOnly !== undefined || !!opts.readOnly) || false;
+ Ember.deprecate("Passing opts.readOnly to the CP constructor is deprecated. All CPs are writable by default. Yo can invoke `readOnly()` on the CP to change this.", !opts || !opts.hasOwnProperty('readOnly'));
+ this._readOnly = opts && (opts.readOnly !== undefined || !!opts.readOnly) || false; // TODO: Set always to `false` once this deprecation is gone.
}
ComputedProperty.prototype = new Descriptor();
var ComputedPropertyPrototype = ComputedProperty.prototype;
@@ -3606,12 +3635,14 @@
@method cacheable
@param {Boolean} aFlag optional set to `false` to disable caching
@return {Ember.ComputedProperty} this
@chainable
+ @deprecated All computed properties are cacheble by default. Use `volatile()` instead to opt-out to caching.
*/
ComputedPropertyPrototype.cacheable = function(aFlag) {
+ Ember.deprecate('ComputedProperty.cacheable() is deprecated. All computed properties are cacheable by default.');
this._cacheable = aFlag !== false;
return this;
};
/**
@@ -3629,11 +3660,12 @@
@method volatile
@return {Ember.ComputedProperty} this
@chainable
*/
ComputedPropertyPrototype.volatile = function() {
- return this.cacheable(false);
+ this._cacheable = false;
+ return this;
};
/**
Call on a computed property to set it into read-only mode. When in this
mode the computed property will throw an error when set.
@@ -3653,11 +3685,12 @@
@method readOnly
@return {Ember.ComputedProperty} this
@chainable
*/
ComputedPropertyPrototype.readOnly = function(readOnly) {
- this._readOnly = readOnly === undefined || !!readOnly;
+ Ember.deprecate('Passing arguments to ComputedProperty.readOnly() is deprecated.', arguments.length === 0);
+ this._readOnly = readOnly === undefined || !!readOnly; // Force to true once this deprecation is gone
return this;
};
/**
Sets the dependent keys on this computed property. Pass any number of
@@ -3965,11 +3998,11 @@
The function you pass will be used to both get and set property values.
The function should accept two parameters, key and value. If value is not
undefined you should set the value first. In either case return the
current value of the property.
-
+
A computed property defined in this way might look like this:
```js
var Person = Ember.Object.extend({
firstName: 'Betty',
@@ -3981,16 +4014,16 @@
});
var client = Person.create();
client.get('fullName'); // 'Betty Jones'
-
+
client.set('lastName', 'Fuller');
client.get('fullName'); // 'Betty Fuller'
```
- _Note: This is the prefered way to define computed properties when writing third-party
+ _Note: This is the preferred way to define computed properties when writing third-party
libraries that depend on or use Ember, since there is no guarantee that the user
will have prototype extensions enabled._
You might use this method if you disabled
[Prototype Extensions](http://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/).
@@ -4131,20 +4164,20 @@
Example
```javascript
var ToDoList = Ember.Object.extend({
- done: Ember.computed.empty('todos')
+ isDone: Ember.computed.empty('todos')
});
var todoList = ToDoList.create({
todos: ['Unit Test', 'Documentation', 'Release']
});
- todoList.get('done'); // false
+ todoList.get('isDone'); // false
todoList.get('todos').clear();
- todoList.get('done'); // true
+ todoList.get('isDone'); // true
```
@since 1.6.0
@method computed.empty
@for Ember
@@ -4682,11 +4715,11 @@
computed.reads = computed.oneWay;
/**
Where `computed.oneWay` provides oneWay bindings, `computed.readOnly` provides
a readOnly one way binding. Very often when using `computed.oneWay` one does
- not also want changes to propogate back up, as they will replace the value.
+ not also want changes to propagate back up, as they will replace the value.
This prevents the reverse flow, and also throws an exception when it occurs.
Example
@@ -4809,11 +4842,11 @@
The core Runtime framework is based on the jQuery API with a number of
performance optimizations.
@class Ember
@static
- @version 1.9.1
+ @version 1.10.0-beta.1
*/
if ('undefined' === typeof Ember) {
// Create core object. Make it act like an instance of Ember.Namespace so that
// objects assigned to it are given a sane string representation.
@@ -4836,14 +4869,14 @@
/**
@property VERSION
@type String
- @default '1.9.1'
+ @default '1.10.0-beta.1'
@static
*/
- Ember.VERSION = '1.9.1';
+ Ember.VERSION = '1.10.0-beta.1';
/**
Standard environmental variables. You can define these in a global `EmberENV`
variable before loading Ember to control various configuration settings.
@@ -4985,15 +5018,15 @@
Ember.K = K;
//TODO: ES6 GLOBAL TODO
// Stub out the methods defined by the ember-debug package in case it's not loaded
- if ('undefined' === typeof Ember.assert) { Ember.assert = Ember.K; }
- if ('undefined' === typeof Ember.warn) { Ember.warn = Ember.K; }
- if ('undefined' === typeof Ember.debug) { Ember.debug = Ember.K; }
- if ('undefined' === typeof Ember.runInDebug) { Ember.runInDebug = Ember.K; }
- if ('undefined' === typeof Ember.deprecate) { Ember.deprecate = Ember.K; }
+ if ('undefined' === typeof Ember.assert) { Ember.assert = K; }
+ if ('undefined' === typeof Ember.warn) { Ember.warn = K; }
+ if ('undefined' === typeof Ember.debug) { Ember.debug = K; }
+ if ('undefined' === typeof Ember.runInDebug) { Ember.runInDebug = K; }
+ if ('undefined' === typeof Ember.deprecate) { Ember.deprecate = K; }
if ('undefined' === typeof Ember.deprecateFunc) {
Ember.deprecateFunc = function(_, func) { return func; };
}
__exports__["default"] = Ember;
@@ -5518,49 +5551,34 @@
}
return actions;
}
- function listenersUnion(obj, eventName, otherActions) {
+ function accumulateListeners(obj, eventName, otherActions) {
var meta = obj['__ember_meta__'];
var actions = meta && meta.listeners && meta.listeners[eventName];
if (!actions) { return; }
+
+ var newActions = [];
+
for (var i = actions.length - 3; i >= 0; i -= 3) {
var target = actions[i];
var method = actions[i+1];
var flags = actions[i+2];
var actionIndex = indexOf(otherActions, target, method);
if (actionIndex === -1) {
otherActions.push(target, method, flags);
+ newActions.push(target, method, flags);
}
}
- }
- __exports__.listenersUnion = listenersUnion;function listenersDiff(obj, eventName, otherActions) {
- var meta = obj['__ember_meta__'];
- var actions = meta && meta.listeners && meta.listeners[eventName];
- var diffActions = [];
-
- if (!actions) { return; }
- for (var i = actions.length - 3; i >= 0; i -= 3) {
- var target = actions[i];
- var method = actions[i+1];
- var flags = actions[i+2];
- var actionIndex = indexOf(otherActions, target, method);
-
- if (actionIndex !== -1) { continue; }
-
- otherActions.push(target, method, flags);
- diffActions.push(target, method, flags);
- }
-
- return diffActions;
+ return newActions;
}
- __exports__.listenersDiff = listenersDiff;/**
+ __exports__.accumulateListeners = accumulateListeners;/**
Add an event listener
@method addListener
@for Ember
@param obj
@@ -6013,10 +6031,11 @@
var Ember = __dependency1__["default"];
// Ember.assert
var ComputedProperty = __dependency2__.ComputedProperty;
var Descriptor = __dependency3__.Descriptor;
var create = __dependency4__.create;
+ var meta = __dependency5__.meta;
var inspect = __dependency5__.inspect;
var EmberError = __dependency6__["default"];
/**
Read-only property that returns the result of a container lookup.
@@ -6031,31 +6050,39 @@
*/
function InjectedProperty(type, name) {
this.type = type;
this.name = name;
- this._super$Constructor(function(keyName) {
- Ember.assert("Attempting to lookup an injected property on an object " +
- "without a container, ensure that the object was " +
- "instantiated via a container.", this.container);
+ this._super$Constructor(injectedPropertyGet);
+ this.readOnly();
+ }
- return this.container.lookup(type + ':' + (name || keyName));
- }, { readOnly: true });
+ function injectedPropertyGet(keyName) {
+ var desc = meta(this).descs[keyName];
+
+ Ember.assert("Attempting to lookup an injected property on an object " +
+ "without a container, ensure that the object was " +
+ "instantiated via a container.", this.container);
+
+ return this.container.lookup(desc.type + ':' + (desc.name || keyName));
}
+ function injectedPropertySet(obj, keyName) {
+ throw new EmberError("Cannot set injected property '" + keyName + "' on object: " + inspect(obj));
+ }
+
InjectedProperty.prototype = create(Descriptor.prototype);
var InjectedPropertyPrototype = InjectedProperty.prototype;
var ComputedPropertyPrototype = ComputedProperty.prototype;
InjectedPropertyPrototype._super$Constructor = ComputedProperty;
InjectedPropertyPrototype.get = ComputedPropertyPrototype.get;
+ InjectedPropertyPrototype.readOnly = ComputedPropertyPrototype.readOnly;
- InjectedPropertyPrototype.set = function(obj, keyName) {
- throw new EmberError("Cannot set injected property '" + keyName + "' on object: " + inspect(obj));
- };
+ InjectedPropertyPrototype.set = injectedPropertySet;
InjectedPropertyPrototype.teardown = ComputedPropertyPrototype.teardown;
__exports__["default"] = InjectedProperty;
});
@@ -6514,64 +6541,92 @@
}
__exports__["default"] = keys;
});
define("ember-metal/libraries",
- ["ember-metal/enumerable_utils","exports"],
- function(__dependency1__, __exports__) {
+ ["ember-metal/core","ember-metal/enumerable_utils","exports"],
+ function(__dependency1__, __dependency2__, __exports__) {
"use strict";
- // Provides a way to register library versions with ember.
- var forEach = __dependency1__.forEach;
- var indexOf = __dependency1__.indexOf;
+ var Ember = __dependency1__["default"];
+ var forEach = __dependency2__.forEach;
+ var indexOf = __dependency2__.indexOf;
- var libraries = function() {
- var _libraries = [];
- var coreLibIndex = 0;
+ /**
+ Helper class that allows you to register your library with Ember.
- var getLibrary = function(name) {
- for (var i = 0; i < _libraries.length; i++) {
- if (_libraries[i].name === name) {
- return _libraries[i];
+ Singleton created at `Ember.libraries`.
+
+ @class Libraries
+ @constructor
+ @private
+ */
+ function Libraries() {
+ this._registry = [];
+ this._coreLibIndex = 0;
+ }
+
+ Libraries.prototype = {
+ constructor: Libraries,
+
+ _getLibraryByName: function(name) {
+ var libs = this._registry;
+ var count = libs.length;
+
+ for (var i = 0; i < count; i++) {
+ if (libs[i].name === name) {
+ return libs[i];
}
}
- };
+ },
- _libraries.register = function(name, version) {
- if (!getLibrary(name)) {
- _libraries.push({name: name, version: version});
- }
- };
+ register: function(name, version, isCoreLibrary) {
+ var index = this._registry.length;
- _libraries.registerCoreLibrary = function(name, version) {
- if (!getLibrary(name)) {
- _libraries.splice(coreLibIndex++, 0, {name: name, version: version});
+ if (!this._getLibraryByName(name)) {
+ if (isCoreLibrary) {
+ index = this._coreLibIndex++;
+ }
+ this._registry.splice(index, 0, { name: name, version: version });
+ } else {
+ Ember.warn('Library "' + name + '" is already registered with Ember.');
}
- };
+ },
- _libraries.deRegister = function(name) {
- var lib = getLibrary(name);
- if (lib) _libraries.splice(indexOf(_libraries, lib), 1);
- };
+ registerCoreLibrary: function(name, version) {
+ this.register(name, version, true);
+ },
- _libraries.each = function (callback) {
- forEach(_libraries, function(lib) {
+ deRegister: function(name) {
+ var lib = this._getLibraryByName(name);
+ var index;
+
+ if (lib) {
+ index = indexOf(this._registry, lib);
+ this._registry.splice(index, 1);
+ }
+ },
+
+ each: function(callback) {
+ Ember.deprecate('Using Ember.libraries.each() is deprecated. Access to a list of registered libraries is currently a private API. If you are not knowingly accessing this method, your out-of-date Ember Inspector may be doing so.');
+ forEach(this._registry, function(lib) {
callback(lib.name, lib.version);
});
- };
+ }
+ };
- return _libraries;
- }();
-
- __exports__["default"] = libraries;
+ __exports__["default"] = Libraries;
});
define("ember-metal/logger",
["ember-metal/core","ember-metal/error","exports"],
function(__dependency1__, __dependency2__, __exports__) {
"use strict";
var Ember = __dependency1__["default"];
+ // Ember.imports
var EmberError = __dependency2__["default"];
+ function K() { return this; }
+
function consoleMethod(name) {
var consoleObj, logToConsole;
if (Ember.imports.console) {
consoleObj = Ember.imports.console;
} else if (typeof console !== 'undefined') {
@@ -6634,11 +6689,11 @@
@method log
@for Ember.Logger
@param {*} arguments
*/
- log: consoleMethod('log') || Ember.K,
+ log: consoleMethod('log') || K,
/**
Prints the arguments to the console with a warning icon.
You can pass as many arguments as you want and they will be joined together with a space.
@@ -6649,11 +6704,11 @@
@method warn
@for Ember.Logger
@param {*} arguments
*/
- warn: consoleMethod('warn') || Ember.K,
+ warn: consoleMethod('warn') || K,
/**
Prints the arguments to the console with an error icon, red text and a stack trace.
You can pass as many arguments as you want and they will be joined together with a space.
@@ -6664,11 +6719,11 @@
@method error
@for Ember.Logger
@param {*} arguments
*/
- error: consoleMethod('error') || Ember.K,
+ error: consoleMethod('error') || K,
/**
Logs the arguments to the console.
You can pass as many arguments as you want and they will be joined together with a space.
@@ -6680,11 +6735,11 @@
@method info
@for Ember.Logger
@param {*} arguments
*/
- info: consoleMethod('info') || Ember.K,
+ info: consoleMethod('info') || K,
/**
Logs the arguments to the console in blue text.
You can pass as many arguments as you want and they will be joined together with a space.
@@ -6696,11 +6751,11 @@
@method debug
@for Ember.Logger
@param {*} arguments
*/
- debug: consoleMethod('debug') || consoleMethod('info') || Ember.K,
+ debug: consoleMethod('debug') || consoleMethod('info') || K,
/**
If the value passed into `Ember.Logger.assert` is not truthy it will throw an error with a stack trace.
```javascript
@@ -7288,11 +7343,10 @@
var trySet = __dependency6__.trySet;
var guidFor = __dependency7__.guidFor;
var metaFor = __dependency7__.meta;
var wrap = __dependency7__.wrap;
var makeArray = __dependency7__.makeArray;
- var apply = __dependency7__.apply;
var isArray = __dependency7__.isArray;
var expandProperties = __dependency8__["default"];
var Descriptor = __dependency9__.Descriptor;
var defineProperty = __dependency9__.defineProperty;
var ComputedProperty = __dependency10__.ComputedProperty;
@@ -7309,22 +7363,39 @@
var a_slice = [].slice;
function superFunction(){
var func = this.__nextSuper;
var ret;
+
if (func) {
- var args = new Array(arguments.length);
- for (var i = 0, l = args.length; i < l; i++) {
- args[i] = arguments[i];
- }
+ var length = arguments.length;
this.__nextSuper = null;
- ret = apply(this, func, args);
+ if (length === 0) {
+ ret = func.call(this);
+ } else if (length === 1) {
+ ret = func.call(this, arguments[0]);
+ } else if (length === 2) {
+ ret = func.call(this, arguments[0], arguments[1]);
+ } else {
+ ret = func.apply(this, arguments);
+ }
this.__nextSuper = func;
+ return ret;
}
- return ret;
}
+ // ensure we prime superFunction to mitigate
+ // v8 bug potentially incorrectly deopts this function: https://code.google.com/p/v8/issues/detail?id=3709
+ var primer = {
+ __nextSuper: function(a,b,c,d ) { }
+ };
+
+ superFunction.call(primer);
+ superFunction.call(primer, 1);
+ superFunction.call(primer, 1, 2);
+ superFunction.call(primer, 1, 2, 3);
+
function mixinsMeta(obj) {
var m = metaFor(obj, true);
var ret = m.mixins;
if (!ret) {
ret = m.mixins = {};
@@ -8865,12 +8936,11 @@
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
"use strict";
var guidFor = __dependency1__.guidFor;
var tryFinally = __dependency1__.tryFinally;
var sendEvent = __dependency2__.sendEvent;
- var listenersUnion = __dependency2__.listenersUnion;
- var listenersDiff = __dependency2__.listenersDiff;
+ var accumulateListeners = __dependency2__.accumulateListeners;
var ObserverSet = __dependency3__["default"];
var beforeObserverSet = new ObserverSet();
var observerSet = new ObserverSet();
var deferred = 0;
@@ -9123,24 +9193,24 @@
@method changeProperties
@param {Function} callback
@param [binding]
*/
- function changeProperties(cb, binding) {
+ function changeProperties(callback, binding) {
beginPropertyChanges();
- tryFinally(cb, endPropertyChanges, binding);
+ tryFinally(callback, endPropertyChanges, binding);
}
function notifyBeforeObservers(obj, keyName) {
if (obj.isDestroying) { return; }
var eventName = keyName + ':before';
- var listeners, diff;
+ var listeners, added;
if (deferred) {
listeners = beforeObserverSet.add(obj, keyName, eventName);
- diff = listenersDiff(obj, eventName, listeners);
- sendEvent(obj, eventName, [obj, keyName], diff);
+ added = accumulateListeners(obj, eventName, listeners);
+ sendEvent(obj, eventName, [obj, keyName], added);
} else {
sendEvent(obj, eventName, [obj, keyName]);
}
}
@@ -9149,11 +9219,11 @@
var eventName = keyName + ':change';
var listeners;
if (deferred) {
listeners = observerSet.add(obj, keyName, eventName);
- listenersUnion(obj, eventName, listeners);
+ accumulateListeners(obj, eventName, listeners);
} else {
sendEvent(obj, eventName, [obj, keyName]);
}
}
@@ -9260,21 +9330,14 @@
return ret;
}
};
- // Currently used only by Ember Data tests
- if (Ember.config.overrideAccessors) {
- Ember.get = get;
- Ember.config.overrideAccessors();
- get = Ember.get;
- }
-
/**
Normalizes a target/path pair to reflect that actual target/path that should
be observed, etc. This takes into account passing in global property
- paths (i.e. a path beginning with a captial letter not defined on the
+ paths (i.e. a path beginning with a capital letter not defined on the
target).
@private
@method normalizeTuple
@for Ember
@@ -9446,18 +9509,10 @@
}
}
return value;
};
- // Currently used only by Ember Data tests
- // ES6TODO: Verify still true
- if (Ember.config.overrideAccessors) {
- Ember.set = set;
- Ember.config.overrideAccessors();
- set = Ember.set;
- }
-
function setPath(root, path, value, tolerant) {
var keyName;
// get the last part of the path
keyName = path.slice(path.lastIndexOf('.') + 1);
@@ -10177,51 +10232,21 @@
}
});
return obj;
}
});
-define("ember-metal/streams/read",
- ["exports"],
- function(__exports__) {
- "use strict";
- function read(object) {
- if (object && object.isStream) {
- return object.value();
- } else {
- return object;
- }
- }
-
- __exports__.read = read;function readArray(array) {
- var length = array.length;
- var ret = new Array(length);
- for (var i = 0; i < length; i++) {
- ret[i] = read(array[i]);
- }
- return ret;
- }
-
- __exports__.readArray = readArray;function readHash(object) {
- var ret = {};
- for (var key in object) {
- ret[key] = read(object[key]);
- }
- return ret;
- }
-
- __exports__.readHash = readHash;
- });
define("ember-metal/streams/simple",
- ["ember-metal/merge","ember-metal/streams/stream","ember-metal/platform","ember-metal/streams/read","exports"],
+ ["ember-metal/merge","ember-metal/streams/stream","ember-metal/platform","ember-metal/streams/utils","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {
"use strict";
var merge = __dependency1__["default"];
var Stream = __dependency2__["default"];
var create = __dependency3__.create;
var read = __dependency4__.read;
function SimpleStream(source) {
+ this.init();
this.source = source;
if (source && source.isStream) {
source.subscribe(this._didChange, this);
}
@@ -10260,17 +10285,20 @@
_didChange: function() {
this.notify();
},
+ _super$destroy: Stream.prototype.destroy,
+
destroy: function() {
- if (this.source && this.source.isStream) {
- this.source.unsubscribe(this._didChange, this);
+ if (this._super$destroy()) {
+ if (this.source && this.source.isStream) {
+ this.source.unsubscribe(this._didChange, this);
+ }
+ this.source = undefined;
+ return true;
}
-
- this.source = undefined;
- Stream.prototype.destroy.call(this);
}
});
__exports__["default"] = SimpleStream;
});
@@ -10280,24 +10308,25 @@
"use strict";
var create = __dependency1__.create;
var getFirstKey = __dependency2__.getFirstKey;
var getTailPath = __dependency2__.getTailPath;
- var NIL = function NIL(){};
-
function Stream(fn) {
+ this.init();
this.valueFn = fn;
- this.cache = NIL;
- this.subscribers = undefined;
- this.children = undefined;
- this.destroyed = false;
}
Stream.prototype = {
isStream: true,
- cache: NIL,
+ init: function() {
+ this.state = 'dirty';
+ this.cache = undefined;
+ this.subscribers = undefined;
+ this.children = undefined;
+ this._label = undefined;
+ },
get: function(path) {
var firstKey = getFirstKey(path);
var tailPath = getTailPath(path);
@@ -10318,29 +10347,38 @@
return keyStream.get(tailPath);
}
},
value: function() {
- if (this.cache !== NIL) {
+ if (this.state === 'clean') {
return this.cache;
- } else {
+ } else if (this.state === 'dirty') {
+ this.state = 'clean';
return this.cache = this.valueFn();
}
+ // TODO: Ensure value is never called on a destroyed stream
+ // so that we can uncomment this assertion.
+ //
+ // Ember.assert("Stream error: value was called in an invalid state: " + this.state);
},
+ valueFn: function() {
+ throw new Error("Stream error: valueFn not implemented");
+ },
+
setValue: function() {
throw new Error("Stream error: setValue not implemented");
},
notify: function() {
this.notifyExcept();
},
notifyExcept: function(callbackToSkip, contextToSkip) {
- if (this.cache !== NIL) {
- this.cache = NIL;
- this.notifySubscribers(callbackToSkip, contextToSkip);
+ if (this.state === 'clean') {
+ this.state = 'dirty';
+ this._notifySubscribers(callbackToSkip, contextToSkip);
}
},
subscribe: function(callback, context) {
if (this.subscribers === undefined) {
@@ -10361,11 +10399,11 @@
}
}
}
},
- notifySubscribers: function(callbackToSkip, contextToSkip) {
+ _notifySubscribers: function(callbackToSkip, contextToSkip) {
var subscribers = this.subscribers;
if (subscribers !== undefined) {
for (var i = 0, l = subscribers.length; i < l; i += 2) {
var callback = subscribers[i];
@@ -10383,16 +10421,19 @@
}
}
},
destroy: function() {
- if (this.destroyed) return;
- this.destroyed = true;
+ if (this.state !== 'destroyed') {
+ this.state = 'destroyed';
- var children = this.children;
- for (var key in children) {
- children[key].destroy();
+ var children = this.children;
+ for (var key in children) {
+ children[key].destroy();
+ }
+
+ return true;
}
},
isGlobal: function() {
var stream = this;
@@ -10417,15 +10458,15 @@
var Stream = __dependency4__["default"];
function StreamBinding(stream) {
Ember.assert("StreamBinding error: tried to bind to object that is not a stream", stream && stream.isStream);
+ this.init();
this.stream = stream;
this.senderCallback = undefined;
this.senderContext = undefined;
this.senderValue = undefined;
- this.destroyed = false;
stream.subscribe(this._onNotify, this);
}
StreamBinding.prototype = create(Stream.prototype);
@@ -10455,11 +10496,11 @@
this.senderValue = value;
}
},
_sync: function() {
- if (this.destroyed) {
+ if (this.state === 'destroyed') {
return;
}
if (this.senderContext !== this) {
this.stream.setValue(this.senderValue);
@@ -10470,27 +10511,74 @@
this.senderCallback = undefined;
this.senderContext = undefined;
this.senderValue = undefined;
// Force StreamBindings to always notify
- this.cache = undefined;
+ this.state = 'clean';
this.notifyExcept(senderCallback, senderContext);
},
+ _super$destroy: Stream.prototype.destroy,
+
destroy: function() {
- if (this.destroyed) {
- return;
+ if (this._super$destroy()) {
+ this.stream.unsubscribe(this._onNotify, this);
+ return true;
}
-
- this.destroyed = true;
- this.stream.unsubscribe(this._onNotify, this);
}
});
__exports__["default"] = StreamBinding;
});
+define("ember-metal/streams/utils",
+ ["exports"],
+ function(__exports__) {
+ "use strict";
+ function isStream(object) {
+ return object && object.isStream;
+ }
+
+ __exports__.isStream = isStream;function subscribe(object, callback, context) {
+ if (object && object.isStream) {
+ object.subscribe(callback, context);
+ }
+ }
+
+ __exports__.subscribe = subscribe;function unsubscribe(object, callback, context) {
+ if (object && object.isStream) {
+ object.unsubscribe(callback, context);
+ }
+ }
+
+ __exports__.unsubscribe = unsubscribe;function read(object) {
+ if (object && object.isStream) {
+ return object.value();
+ } else {
+ return object;
+ }
+ }
+
+ __exports__.read = read;function readArray(array) {
+ var length = array.length;
+ var ret = new Array(length);
+ for (var i = 0; i < length; i++) {
+ ret[i] = read(array[i]);
+ }
+ return ret;
+ }
+
+ __exports__.readArray = readArray;function readHash(object) {
+ var ret = {};
+ for (var key in object) {
+ ret[key] = read(object[key]);
+ }
+ return ret;
+ }
+
+ __exports__.readHash = readHash;
+ });
define("ember-metal/utils",
["ember-metal/core","ember-metal/platform","ember-metal/array","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
// Remove "use strict"; from transpiled module until
// https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
@@ -10564,17 +10652,17 @@
Unfortunately checking equality of different ropes can be quite costly as
runtimes must resort to clever string comparison algorithims. These
algorithims typically cost in proportion to the length of the string.
Luckily, this is where the Symbols (interned strings) shine. As Symbols are
unique by their string content, equality checks can be done by pointer
- comparision.
+ comparison.
How do I know if my string is a rope or symbol?
Typically (warning general sweeping statement, but truthy in runtimes at
present) static strings created as part of the JS source are interned.
- Strings often used for comparisions can be interned at runtime if some
+ Strings often used for comparisons can be interned at runtime if some
criteria are met. One of these criteria can be the size of the entire rope.
For example, in chrome 38 a rope longer then 12 characters will not
intern, nor will segments of that rope.
Some numbers: http://jsperf.com/eval-vs-keys/8
@@ -10889,21 +10977,39 @@
@for Ember
@param {Function} func The function to call
@param {Function} superFunc The super function.
@return {Function} wrapped function.
*/
+
function wrap(func, superFunc) {
function superWrapper() {
var ret;
var sup = this && this.__nextSuper;
- var args = new Array(arguments.length);
- for (var i = 0, l = args.length; i < l; i++) {
- args[i] = arguments[i];
+ var length = arguments.length;
+
+ if (this) {
+ this.__nextSuper = superFunc;
}
- if(this) { this.__nextSuper = superFunc; }
- ret = apply(this, func, args);
- if(this) { this.__nextSuper = sup; }
+
+ if (length === 0) {
+ ret = func.call(this);
+ } else if (length === 1) {
+ ret = func.call(this, arguments[0]);
+ } else if (length === 2) {
+ ret = func.call(this, arguments[0], arguments[1]);
+ } else {
+ var args = new Array(length);
+ for (var i = 0; i < length; i++) {
+ args[i] = arguments[i];
+ }
+ ret = apply(this, func, args);
+ }
+
+ if (this) {
+ this.__nextSuper = sup;
+ }
+
return ret;
}
superWrapper.wrappedFunction = func;
superWrapper.wrappedFunction.__ember_arity__ = func.length;
@@ -10989,11 +11095,11 @@
__exports__.makeArray = makeArray;/**
Checks to see if the `methodName` exists on the `obj`.
```javascript
- var foo = { bar: Ember.K, baz: null };
+ var foo = { bar: function() { return 'bar'; }, baz: null };
Ember.canInvoke(foo, 'bar'); // true
Ember.canInvoke(foo, 'baz'); // false
Ember.canInvoke(foo, 'bat'); // false
```
@@ -11708,10 +11814,13 @@
Ember.compare = compare;
Ember.copy = copy;
Ember.isEqual = isEqual;
+ Ember.inject = inject;
+
+
Ember.Array = EmberArray;
Ember.Comparable = Comparable;
Ember.Copyable = Copyable;
@@ -11780,10 +11889,13 @@
Ember.ObjectController = ObjectController;
Ember.Controller = Controller;
Ember.ControllerMixin = ControllerMixin;
+ Ember.Service = Service;
+
+
Ember._ProxyMixin = _ProxyMixin;
Ember.RSVP = RSVP;
// END EXPORTS
@@ -11848,20 +11960,21 @@
var type1 = typeOf(v);
var type2 = typeOf(w);
if (Comparable) {
- if (type1 ==='instance' && Comparable.detect(v.constructor)) {
+ if (type1 === 'instance' && Comparable.detect(v) && v.constructor.compare) {
return v.constructor.compare(v, w);
}
- if (type2 === 'instance' && Comparable.detect(w.constructor)) {
- return 1 - w.constructor.compare(w, v);
+ if (type2 === 'instance' && Comparable.detect(w) && w.constructor.compare) {
+ return w.constructor.compare(w, v) * -1;
}
}
var res = spaceship(TYPE_ORDER[type1], TYPE_ORDER[type2]);
+
if (res !== 0) {
return res;
}
// types are equal - so we have to check values now
@@ -12569,17 +12682,17 @@
function ReduceComputedProperty(options) {
var cp = this;
this.options = options;
this._dependentKeys = null;
+ this._cacheable = true;
// A map of dependentKey -> [itemProperty, ...] that tracks what properties of
// items in the array we must track to update this property.
this._itemPropertyKeys = {};
this._previousItemPropertyKeys = {};
this.readOnly();
- this.cacheable();
this.recomputeOnce = function(propertyName) {
// What we really want to do is coalesce by <cp, propertyName>.
// We need a form of `scheduleOnce` that accepts an arbitrary token to
// coalesce by, in addition to the target and method.
@@ -14109,10 +14222,42 @@
Ember.assert("Defining an injected controller property on a " +
"non-controller is not allowed.", Controller.detect(factory));
}
+ /**
+ Creates a property that lazily looks up another controller in the container.
+ Can only be used when defining another controller.
+
+ Example:
+
+ ```javascript
+ App.PostController = Ember.Controller.extend({
+ posts: Ember.inject.controller()
+ });
+ ```
+
+ This example will create a `posts` property on the `post` controller that
+ looks up the `posts` controller in the container, making it easy to
+ reference other controllers. This is functionally equivalent to:
+
+ ```javascript
+ App.PostController = Ember.Controller.extend({
+ needs: 'posts',
+ posts: Ember.computed.alias('controllers.posts')
+ });
+ ```
+
+ @method inject.controller
+ @for Ember
+ @param {String} name (optional) name of the controller to inject, defaults
+ to the property's name
+ @return {Ember.InjectedProperty} injection descriptor instance
+ */
+ createInjectionHelper('controller', controllerInjectionHelper);
+
+
__exports__["default"] = Controller;
});
define("ember-runtime/controllers/object_controller",
["ember-runtime/mixins/controller","ember-runtime/system/object_proxy","exports"],
function(__dependency1__, __dependency2__, __exports__) {
@@ -14419,15 +14564,19 @@
@method observesImmediately
@for Function
*/
FunctionPrototype.observesImmediately = function () {
- for (var i = 0, l = arguments.length; i < l; i++) {
- var arg = arguments[i];
- Ember.assert('Immediate observers must observe internal properties only, ' +
- 'not properties on other objects.', arg.indexOf('.') === -1);
- }
+ Ember.assert('Immediate observers must observe internal properties only, ' +
+ 'not properties on other objects.', function checkIsInternalProperty() {
+ for(var i = 0, l = arguments.length; i < l; i++) {
+ if(arguments[i].indexOf('.') !== -1) {
+ return false;
+ }
+ }
+ return true;
+ });
// observes handles property expansion
return this.observes.apply(this, arguments);
};
@@ -14542,11 +14691,21 @@
RSVP.Promise.prototype.fail = function(callback, label){
Ember.deprecate('RSVP.Promise.fail has been renamed as RSVP.Promise.catch');
return this['catch'](callback, label);
};
- RSVP.onerrorDefault = function (error) {
+ RSVP.onerrorDefault = function (e) {
+ var error;
+
+ if (e && e.errorThrown) {
+ // jqXHR provides this
+ error = e.errorThrown;
+ error.__reason_with_error_thrown__ = e;
+ } else {
+ error = e;
+ }
+
if (error && error.name !== 'TransitionAborted') {
if (Ember.testing) {
// ES6TODO: remove when possible
if (!Test && Ember.__loader.registry[testModuleName]) {
Test = requireModule(testModuleName)['default'];
@@ -14686,18 +14845,19 @@
return capitalize(this);
};
}
});
define("ember-runtime/inject",
- ["ember-metal/core","ember-metal/enumerable_utils","ember-metal/injected_property","ember-metal/keys","exports"],
- function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {
+ ["ember-metal/core","ember-metal/enumerable_utils","ember-metal/utils","ember-metal/injected_property","ember-metal/keys","exports"],
+ function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __exports__) {
"use strict";
var Ember = __dependency1__["default"];
// Ember.assert
var indexOf = __dependency2__.indexOf;
- var InjectedProperty = __dependency3__["default"];
- var keys = __dependency4__["default"];
+ var meta = __dependency3__.meta;
+ var InjectedProperty = __dependency4__["default"];
+ var keys = __dependency5__["default"];
/**
Namespace for injection helper methods.
@class inject
@@ -14729,30 +14889,26 @@
return new InjectedProperty(type, name);
};
}
__exports__.createInjectionHelper = createInjectionHelper;/**
- Validation function intended to be invoked at when extending a factory with
- injected properties. Runs per-type validation functions once for each injected
- type encountered.
+ Validation function that runs per-type validation functions once for each
+ injected type encountered.
- Note that this currently modifies the mixin themselves, which is technically
- dubious but is practically of little consequence. This may change in the
- future.
-
@private
@method validatePropertyInjections
@namespace Ember
- @param {Object} factory The factory object being extended
- @param {Object} props A hash of properties to be added to the factory
+ @param {Object} factory The factory object
*/
- function validatePropertyInjections(factory, props) {
+ function validatePropertyInjections(factory) {
+ var proto = factory.proto();
+ var descs = meta(proto).descs;
var types = [];
var key, desc, validator, i, l;
- for (key in props) {
- desc = props[key];
+ for (key in descs) {
+ desc = descs[key];
if (desc instanceof InjectedProperty && indexOf(types, desc.type) === -1) {
types.push(desc.type);
}
}
@@ -15027,11 +15183,10 @@
@private
@method willMergeMixin
*/
willMergeMixin: function(props) {
-
var hashName;
if (!props._actions) {
Ember.assert("'actions' should not be a function", typeof(props.actions) !== 'function');
@@ -15745,11 +15900,11 @@
Ember versions prior to 1.7 used `model` as an alias of `content`, but due to
much confusion this alias was reversed (so `content` is now an alias of `model).
This change reduces many caveats with model/content, and also sets a
simple ground rule: Never set a controllers content, rather always set
- it's model and ember will do the right thing.
+ its model and ember will do the right thing.
`Ember.ControllerContentModelAliasDeprecation` is used internally by Ember in
`Ember.Controller`.
@@ -17093,11 +17248,11 @@
@since 1.2.0
*/
sortBy: function() {
var sortKeys = arguments;
- return this.toArray().sort(function(a, b){
+ return this.toArray().sort(function(a, b) {
for(var i = 0; i < sortKeys.length; i++) {
var key = sortKeys[i];
var propA = get(a, key);
var propB = get(b, key);
// return 1 or -1 else continue to the next sortKey
@@ -18173,10 +18328,11 @@
this.propertyDidChange(keyName);
return this;
},
addBeforeObserver: function(key, target, method) {
+ Ember.deprecate('Before observers are deprecated and will be removed in a future release. If you want to keep track of previous values you have to implement it yourself. See http://emberjs.com/guides/deprecations#toc_deprecate-beforeobservers');
addBeforeObserver(this, key, target, method);
},
/**
Adds an observer on a property.
@@ -18313,11 +18469,11 @@
set(this, keyName, (get(this, keyName) || 0) - decrement);
return get(this, keyName);
},
/**
- Set the value of a boolean property to the opposite of it's
+ Set the value of a boolean property to the opposite of its
current value.
```javascript
starship.toggleProperty('warpDriveEngaged');
```
@@ -19030,11 +19186,11 @@
define("ember-runtime/system/array_proxy",
["ember-metal/core","ember-metal/property_get","ember-metal/utils","ember-metal/computed","ember-metal/mixin","ember-metal/property_events","ember-metal/error","ember-runtime/system/object","ember-runtime/mixins/mutable_array","ember-runtime/mixins/enumerable","ember-runtime/system/string","ember-metal/alias","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __exports__) {
"use strict";
var Ember = __dependency1__["default"];
- // Ember.K, Ember.assert
+ // Ember.assert
var get = __dependency2__.get;
var isArray = __dependency3__.isArray;
var apply = __dependency3__.apply;
var computed = __dependency4__.computed;
var beforeObserver = __dependency5__.beforeObserver;
@@ -19053,12 +19209,13 @@
@submodule ember-runtime
*/
var OUT_OF_RANGE_EXCEPTION = "Index out of range";
var EMPTY = [];
- var K = Ember.K;
+ function K() { return this; }
+
/**
An ArrayProxy wraps any other object that implements `Ember.Array` and/or
`Ember.MutableArray,` forwarding all requests. This makes it very useful for
a number of binding use cases or other cases where being able to swap
out the underlying array is useful.
@@ -19414,12 +19571,12 @@
Container.set = set;
__exports__["default"] = Container;
});
define("ember-runtime/system/core_object",
- ["ember-metal/core","ember-metal/property_get","ember-metal/utils","ember-metal/platform","ember-metal/chains","ember-metal/events","ember-metal/mixin","ember-metal/enumerable_utils","ember-metal/error","ember-metal/keys","ember-runtime/mixins/action_handler","ember-metal/properties","ember-metal/binding","ember-metal/computed","ember-metal/injected_property","ember-metal/run_loop","ember-metal/watching","exports"],
- function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __dependency15__, __dependency16__, __dependency17__, __exports__) {
+ ["ember-metal/core","ember-metal/property_get","ember-metal/utils","ember-metal/platform","ember-metal/chains","ember-metal/events","ember-metal/mixin","ember-metal/enumerable_utils","ember-metal/error","ember-metal/keys","ember-runtime/mixins/action_handler","ember-metal/properties","ember-metal/binding","ember-metal/computed","ember-metal/injected_property","ember-metal/run_loop","ember-metal/watching","ember-runtime/inject","exports"],
+ function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __dependency15__, __dependency16__, __dependency17__, __dependency18__, __exports__) {
// Remove "use strict"; from transpiled module until
// https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
//
// REMOVE_USE_STRICT: true
@@ -19427,11 +19584,11 @@
@module ember
@submodule ember-runtime
*/
var Ember = __dependency1__["default"];
- // Ember.assert, Ember.K, Ember.config
+ // Ember.assert, Ember.config
// NOTE: this object should never be included directly. Instead use `Ember.Object`.
// We only define this separately so that `Ember.Set` can depend on it.
var get = __dependency2__.get;
var guidFor = __dependency3__.guidFor;
@@ -19458,10 +19615,11 @@
var InjectedProperty = __dependency15__["default"];
var run = __dependency16__["default"];
var destroy = __dependency17__.destroy;
var K = __dependency1__.K;
var hasPropertyAccessors = __dependency4__.hasPropertyAccessors;
+ var validatePropertyInjections = __dependency18__.validatePropertyInjections;
var schedule = run.schedule;
var applyMixin = Mixin._apply;
var finishPartial = Mixin.finishPartial;
var reopen = Mixin.prototype.reopen;
@@ -19545,11 +19703,11 @@
Ember.assert("Ember.Object.create no longer supports defining methods that call _super.", !(typeof value === 'function' && value.toString().indexOf('._super') !== -1));
Ember.assert("`actions` must be provided at extend time, not at create " +
"time, when Ember.ActionHandler is used (i.e. views, " +
"controllers & routes).", !((keyName === 'actions') && ActionHandler.detect(this)));
- if (concatenatedProperties &&
+ if (concatenatedProperties &&
concatenatedProperties.length > 0 &&
indexOf(concatenatedProperties, keyName) >= 0) {
var baseValue = this[keyName];
if (baseValue) {
@@ -19578,20 +19736,32 @@
}
}
}
}
}
+
finishPartial(this, m);
+
var length = arguments.length;
- var args = new Array(length);
- for (var x = 0; x < length; x++) {
- args[x] = arguments[x];
+
+ if (length === 0) {
+ this.init();
+ } else if (length === 1) {
+ this.init(arguments[0]);
+ } else {
+ // v8 bug potentially incorrectly deopts this function: https://code.google.com/p/v8/issues/detail?id=3709
+ // we may want to keep this around till this ages out on mobile
+ var args = new Array(length);
+ for (var x = 0; x < length; x++) {
+ args[x] = arguments[x];
+ }
+ this.init.apply(this, args);
}
- apply(this, this.init, args);
+
m.proto = proto;
finishChains(this);
- sendEvent(this, "init");
+ sendEvent(this, 'init');
};
Class.toString = Mixin.prototype.toString;
Class.willReopen = function() {
if (wasApplied) {
@@ -19854,14 +20024,10 @@
function makeToString(ret) {
return function() { return ret; };
}
- if (Ember.config.overridePrototypeMixin) {
- Ember.config.overridePrototypeMixin(CoreObject.PrototypeMixin);
- }
-
CoreObject.__super__ = null;
var ClassMixinProps = {
ClassMixin: required(),
@@ -20247,19 +20413,57 @@
callback.call(binding || this, property.name, property.meta || empty);
}
}
};
+ function injectedPropertyAssertion() {
+ Ember.assert("Injected properties are invalid", validatePropertyInjections(this));
+ }
+
+ function addOnLookupHandler() {
+ Ember.runInDebug(function() {
+ /**
+ Provides lookup-time type validation for injected properties.
+
+ @private
+ @method _onLookup
+ */
+ ClassMixinProps._onLookup = injectedPropertyAssertion;
+ });
+ }
+
+ addOnLookupHandler();
+
+ /**
+ Returns a hash of property names and container names that injected
+ properties will lookup on the container lazily.
+
+ @method _lazyInjections
+ @return {Object} Hash of all lazy injected property keys to container names
+ */
+ ClassMixinProps._lazyInjections = function() {
+ var injections = {};
+ var proto = this.proto();
+ var descs = meta(proto).descs;
+ var key, desc;
+
+ for (key in descs) {
+ desc = descs[key];
+ if (desc instanceof InjectedProperty) {
+ injections[key] = desc.type + ':' + (desc.name || key);
+ }
+ }
+
+ return injections;
+ };
+
+
var ClassMixin = Mixin.create(ClassMixinProps);
ClassMixin.ownerConstructor = CoreObject;
- if (Ember.config.overrideClassMixin) {
- Ember.config.overrideClassMixin(ClassMixin);
- }
-
CoreObject.ClassMixin = ClassMixin;
ClassMixin.apply(CoreObject);
CoreObject.reopen({
@@ -21008,23 +21212,20 @@
__exports__.A = A;
__exports__.NativeArray = NativeArray;
__exports__["default"] = NativeArray;
});
define("ember-runtime/system/object",
- ["ember-metal/core","ember-runtime/system/core_object","ember-runtime/mixins/observable","ember-runtime/inject","exports"],
- function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {
+ ["ember-runtime/system/core_object","ember-runtime/mixins/observable","exports"],
+ function(__dependency1__, __dependency2__, __exports__) {
"use strict";
/**
@module ember
@submodule ember-runtime
*/
- var Ember = __dependency1__["default"];
- // Ember.assert
- var CoreObject = __dependency2__["default"];
- var Observable = __dependency3__["default"];
- var validatePropertyInjections = __dependency4__.validatePropertyInjections;
+ var CoreObject = __dependency1__["default"];
+ var Observable = __dependency2__["default"];
/**
`Ember.Object` is the main base class for all Ember objects. It is a subclass
of `Ember.CoreObject` with the `Ember.Observable` mixin applied. For details,
see the documentation for each of these.
@@ -21037,17 +21238,10 @@
var EmberObject = CoreObject.extend(Observable);
EmberObject.toString = function() {
return "Ember.Object";
};
- function injectedPropertyAssertion(props) {
- // Injection validations are a debugging aid only, so ensure that they are
- // not performed in production builds by invoking from an assertion
- Ember.assert("Injected properties are invalid", validatePropertyInjections(this.constructor, props));
- }
-
-
__exports__["default"] = EmberObject;
});
define("ember-runtime/system/object_proxy",
["ember-runtime/system/object","ember-runtime/mixins/-proxy","exports"],
function(__dependency1__, __dependency2__, __exports__) {
@@ -21134,9 +21328,45 @@
var createInjectionHelper = __dependency2__.createInjectionHelper;
var Service;
+ /**
+ @class Service
+ @namespace Ember
+ @extends Ember.Object
+ */
+ Service = Object.extend();
+
+ /**
+ Creates a property that lazily looks up a service in the container. There
+ are no restrictions as to what objects a service can be injected into.
+
+ Example:
+
+ ```javascript
+ App.ApplicationRoute = Ember.Route.extend({
+ authManager: Ember.inject.service('auth'),
+
+ model: function() {
+ return this.get('authManager').findCurrentUser();
+ }
+ });
+ ```
+
+ This example will create an `authManager` property on the application route
+ that looks up the `auth` service in the container, making it easily
+ accessible in the `model` hook.
+
+ @method inject.service
+ @for Ember
+ @param {String} name (optional) name of the service to inject, defaults to
+ the property's name
+ @return {Ember.InjectedProperty} injection descriptor instance
+ */
+ createInjectionHelper('service');
+
+
__exports__["default"] = Service;
});
define("ember-runtime/system/set",
["ember-metal/core","ember-metal/property_get","ember-metal/property_set","ember-metal/utils","ember-metal/is_none","ember-runtime/system/string","ember-runtime/system/core_object","ember-runtime/mixins/mutable_enumerable","ember-runtime/mixins/enumerable","ember-runtime/mixins/copyable","ember-runtime/mixins/freezable","ember-metal/error","ember-metal/property_events","ember-metal/mixin","ember-metal/computed","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __dependency15__, __exports__) {