dist/ember-runtime.js in ember-source-2.5.0.beta.4 vs dist/ember-runtime.js in ember-source-2.5.0
- old
+ new
@@ -4,11 +4,11 @@
* @copyright Copyright 2011-2016 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 2.5.0-beta.4
+ * @version 2.5.0
*/
var enifed, requireModule, require, requirejs, Ember;
var mainContext = this;
@@ -3491,14 +3491,10 @@
function UNDEFINED() {}
var DEEP_EACH_REGEX = /\.@each\.[^.]+\./;
- // ..........................................................
- // COMPUTED PROPERTY
- //
-
/**
A computed property transforms an object literal with object's accessor function(s) into a property.
By default the function backing the computed property will only be called
once and the result will be cached. You can specify various properties
@@ -3597,11 +3593,10 @@
- [New CP syntax RFC](https://github.com/emberjs/rfcs/blob/master/text/0011-improved-cp-syntax.md)
- [New computed syntax explained in "Ember 1.12 released" ](http://emberjs.com/blog/2015/05/13/ember-1-12-released.html#toc_new-computed-syntax)
@class ComputedProperty
@namespace Ember
- @constructor
@public
*/
function ComputedProperty(config, opts) {
this.isDescriptor = true;
if (typeof config === 'function') {
@@ -3756,11 +3751,10 @@
@method meta
@param {Object} meta
@chainable
@public
*/
-
ComputedPropertyPrototype.meta = function (meta) {
if (arguments.length === 0) {
return this._meta || {};
} else {
this._meta = meta;
@@ -3787,37 +3781,10 @@
cache[keyName] = undefined;
_emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, meta);
}
};
- /**
- Access the value of the function backing the computed property.
- If this property has already been cached, return the cached result.
- Otherwise, call the function passing the property name as an argument.
-
- ```javascript
- let Person = Ember.Object.extend({
- fullName: Ember.computed('firstName', 'lastName', function(keyName) {
- // the keyName parameter is 'fullName' in this case.
- return this.get('firstName') + ' ' + this.get('lastName');
- })
- });
-
-
- let tom = Person.create({
- firstName: 'Tom',
- lastName: 'Dale'
- });
-
- tom.get('fullName') // 'Tom Dale'
- ```
-
- @method get
- @param {String} keyName The key being accessed.
- @return {Object} The return value of the function backing the CP.
- @public
- */
ComputedPropertyPrototype.get = function (obj, keyName) {
if (this._volatile) {
return this._getter.call(obj, keyName);
}
@@ -3845,58 +3812,10 @@
_emberMetalDependent_keys.addDependentKeys(this, obj, keyName, meta);
return ret;
};
- /**
- Set the value of a computed property. If the function that backs your
- computed property does not accept arguments then the default action for
- setting would be to define the property on the current object, and set
- the value of the property to the value being set.
-
- Generally speaking if you intend for your computed property to be set
- you should pass `set(key, value)` function in hash as argument to `Ember.computed()` along with `get(key)` function.
-
- ```javascript
- let Person = Ember.Object.extend({
- // these will be supplied by `create`
- firstName: null,
- lastName: null,
-
- fullName: Ember.computed('firstName', 'lastName', {
- // getter
- get() {
- let firstName = this.get('firstName');
- let lastName = this.get('lastName');
-
- return firstName + ' ' + lastName;
- },
- // setter
- set(key, value) {
- let [firstName, lastName] = value.split(' ');
-
- this.set('firstName', firstName);
- this.set('lastName', lastName);
-
- return value;
- }
- })
- });
-
- let person = Person.create();
-
- person.set('fullName', 'Peter Wagenet');
- person.get('firstName'); // 'Peter'
- person.get('lastName'); // 'Wagenet'
- ```
-
- @method set
- @param {String} keyName The key being accessed.
- @param {Object} newValue The new value being assigned.
- @return {Object} The return value of the function backing the CP.
- @public
- */
ComputedPropertyPrototype.set = function computedPropertySetEntry(obj, keyName, value) {
if (this._readOnly) {
this._throwReadOnlyError(obj, keyName);
}
@@ -4814,21 +4733,19 @@
/**
This namespace contains all Ember methods and functions. Future versions of
Ember may overwrite this namespace and therefore, you should avoid adding any
new properties.
- You can also use the shorthand `Em` instead of `Ember`.
-
At the heart of Ember is Ember-Runtime, a set of core functions that provide
cross-platform compatibility and object property observing. Ember-Runtime is
small and performance-focused so you can use it alongside other
cross-platform libraries such as jQuery. For more details, see
[Ember-Runtime](http://emberjs.com/api/modules/ember-runtime.html).
@class Ember
@static
- @version 2.5.0-beta.4
+ @version 2.5.0
@public
*/
if ('undefined' === typeof Ember) {
// Create core object. Make it act like an instance of Ember.Namespace so that
@@ -4866,15 +4783,15 @@
/**
The semantic version.
@property VERSION
@type String
- @default '2.5.0-beta.4'
+ @default '2.5.0'
@static
@public
*/
- Ember.VERSION = '2.5.0-beta.4';
+ Ember.VERSION = '2.5.0';
/**
The hash of environment variables used to control various configuration
settings. To specify your own or override default settings, add the
desired properties to a global hash named `EmberENV` (or `ENV` for
@@ -5693,13 +5610,15 @@
@namespace Ember
@static
@since 1.1.0
@public
*/
- var FEATURES = _emberMetalAssign.default({}, _emberMetalCore.default.ENV.FEATURES);exports.FEATURES = FEATURES;
+ var KNOWN_FEATURES = {};exports.KNOWN_FEATURES = KNOWN_FEATURES;
// jshint ignore:line
+ var FEATURES = _emberMetalAssign.default(KNOWN_FEATURES, _emberMetalCore.default.ENV.FEATURES);
+ exports.FEATURES = FEATURES;
/**
Determine whether the specified `feature` is enabled. Used by Ember's
build tools to exclude experimental features from beta/stable builds.
You can define the following configuration options:
@@ -7189,11 +7108,13 @@
@public
*/
function merge(original, updates) {
if (_emberMetalFeatures.default('ember-metal-ember-assign')) {
- _emberMetalDebug.deprecate('Usage of `Ember.merge` is deprecated, use `Ember.assign` instead.', false, { id: 'ember-metal.merge', until: '3.0.0' });
+ _emberMetalDebug.deprecate('Usage of `Ember.merge` is deprecated, use `Ember.assign` instead.', false, {
+ id: 'ember-metal.merge', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-merge'
+ });
}
if (!updates || typeof updates !== 'object') {
return original;
}
@@ -9046,13 +8967,13 @@
// define a simple property
Ember.defineProperty(contact, 'lastName', undefined, 'Jolley');
// define a computed property
- Ember.defineProperty(contact, 'fullName', Ember.computed(function() {
+ Ember.defineProperty(contact, 'fullName', Ember.computed('firstName', 'lastName', function() {
return this.firstName+' '+this.lastName;
- }).property('firstName', 'lastName'));
+ }));
```
@private
@method defineProperty
@for Ember
@@ -10681,15 +10602,17 @@
ProxyStream.extend = _emberMetalStreamsStream.default.extend;
exports.default = ProxyStream;
});
-enifed('ember-metal/streams/stream', ['exports', 'ember-metal/assign', 'ember-metal/debug', 'ember-metal/path_cache', 'ember-metal/observer', 'ember-metal/streams/utils', 'ember-metal/empty_object', 'ember-metal/streams/subscriber', 'ember-metal/streams/dependency', 'ember-metal/utils', 'require'], function (exports, _emberMetalAssign, _emberMetalDebug, _emberMetalPath_cache, _emberMetalObserver, _emberMetalStreamsUtils, _emberMetalEmpty_object, _emberMetalStreamsSubscriber, _emberMetalStreamsDependency, _emberMetalUtils, _require) {
+enifed('ember-metal/streams/stream', ['exports', 'ember-metal/assign', 'ember-metal/debug', 'ember-metal/path_cache', 'ember-metal/observer', 'ember-metal/streams/utils', 'ember-metal/empty_object', 'ember-metal/streams/subscriber', 'ember-metal/streams/dependency', 'ember-metal/utils', 'require', 'ember-metal/symbol'], function (exports, _emberMetalAssign, _emberMetalDebug, _emberMetalPath_cache, _emberMetalObserver, _emberMetalStreamsUtils, _emberMetalEmpty_object, _emberMetalStreamsSubscriber, _emberMetalStreamsDependency, _emberMetalUtils, _require, _emberMetalSymbol) {
'use strict';
exports.wrap = wrap;
+ var IS_STREAM = _emberMetalSymbol.default('IS_STREAM');
+ exports.IS_STREAM = IS_STREAM;
/**
@module ember-metal
*/
/**
@@ -10704,13 +10627,12 @@
var KeyStream;
var ProxyMixin;
BasicStream.prototype = {
- isStream: true,
-
_init: function (label) {
+ this[IS_STREAM] = true;
this.label = makeLabel(label);
this.isActive = false;
this.isDirty = true;
this.isDestroyed = false;
this.cache = undefined;
@@ -11106,11 +11028,11 @@
@param {Object|Stream} object Object to check whether it is a stream.
@return {Boolean} `true` if the object is a stream, `false` otherwise.
*/
function isStream(object) {
- return object && object.isStream;
+ return object && object[_emberMetalStreamsStream.IS_STREAM];
}
/*
A method of subscribing to a stream which is safe for use with a non-stream
object. If a non-stream object is passed, the function does nothing.
@@ -11123,11 +11045,11 @@
@param {Object} [context] the callback will be executed with this context if it
is provided.
*/
function subscribe(object, callback, context) {
- if (object && object.isStream) {
+ if (object && object[_emberMetalStreamsStream.IS_STREAM]) {
return object.subscribe(callback, context);
}
}
/*
@@ -11141,11 +11063,11 @@
@param {Function} callback Function originally passed to `subscribe()`.
@param {Object} [context] Object originally passed to `subscribe()`.
*/
function unsubscribe(object, callback, context) {
- if (object && object.isStream) {
+ if (object && object[_emberMetalStreamsStream.IS_STREAM]) {
object.unsubscribe(callback, context);
}
}
/*
@@ -11158,11 +11080,11 @@
@param {Object|Stream} object Object to return the value of.
@return The stream's current value, or the non-stream object itself.
*/
function read(object) {
- if (object && object.isStream) {
+ if (object && object[_emberMetalStreamsStream.IS_STREAM]) {
return object.value();
} else {
return object;
}
}
@@ -11453,11 +11375,11 @@
return fn();
}
}
function setValue(object, value) {
- if (object && object.isStream) {
+ if (object && object[_emberMetalStreamsStream.IS_STREAM]) {
object.setValue(value);
}
}
});
enifed('ember-metal/symbol', ['exports', 'ember-metal/utils'], function (exports, _emberMetalUtils) {
@@ -14871,11 +14793,11 @@
/**
Returns a special object that can be used to observe individual properties
on the array. Just get an equivalent property on this object and it will
return an enumerable that maps automatically to the named key on the
member objects.
- @each should only be used in a non-terminal context. Example:
+ `@each` should only be used in a non-terminal context. Example:
```javascript
myMethod: computed('posts.@each.author', function(){
...
});
```
@@ -15340,10 +15262,11 @@
var arr = [];
arr.get('firstObject'); // undefined
```
@property firstObject
@return {Object} the object or undefined
+ @readOnly
@public
*/
firstObject: _emberMetalComputed.computed('[]', function () {
if (_emberMetalProperty_get.get(this, 'length') === 0) {
return undefined;
@@ -15368,10 +15291,11 @@
var arr = [];
arr.get('lastObject'); // undefined
```
@property lastObject
@return {Object} the last object or undefined
+ @readOnly
@public
*/
lastObject: _emberMetalComputed.computed('[]', function () {
var len = _emberMetalProperty_get.get(this, 'length');
@@ -19734,18 +19658,18 @@
var A;
if (_emberMetalCore.default.EXTEND_PROTOTYPES === true || _emberMetalCore.default.EXTEND_PROTOTYPES.Array) {
NativeArray.apply(Array.prototype);
exports. // ES6TODO: Setting A onto the object returned by ember-metal/core to avoid circles
- A = A = function () {
- var arr = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
- return arr;
+ A = A = function (arr) {
+ return arr || [];
};
} else {
- exports.A = A = function () {
- var arr = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
-
+ exports.A = A = function (arr) {
+ if (!arr) {
+ arr = [];
+ }
return _emberRuntimeMixinsArray.default.detect(arr) ? arr : NativeArray.apply(arr);
};
}
_emberMetalCore.default.A = A;exports.A = A;
@@ -23050,6 +22974,5 @@
requireModule("ember-runtime");
}());
;module.exports = Ember;
-//# sourceMappingURL=ember-runtime.map
\ No newline at end of file