ember-source 2.16.0.beta.1 → 2.16.0.beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/dist/ember-runtime.js +110 -77
- data/dist/ember-template-compiler.js +174 -132
- data/dist/ember-testing.js +1 -1
- data/dist/ember-tests.js +1329 -1251
- data/dist/ember-tests.prod.js +1279 -1249
- data/dist/ember.debug.js +631 -424
- data/dist/ember.min.js +204 -198
- data/dist/ember.prod.js +650 -436
- metadata +3 -3
data/dist/ember.prod.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
|
7
7
|
* @license Licensed under MIT license
|
8
8
|
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
|
9
|
-
* @version 2.16.0-beta.
|
9
|
+
* @version 2.16.0-beta.2
|
10
10
|
*/
|
11
11
|
|
12
12
|
var enifed, requireModule, Ember;
|
@@ -9487,7 +9487,6 @@ enifed('backburner', ['exports'], function (exports) {
|
|
9487
9487
|
this.name = name;
|
9488
9488
|
this.options = options;
|
9489
9489
|
this.globalOptions = globalOptions;
|
9490
|
-
this.globalOptions.onError = getOnError(globalOptions);
|
9491
9490
|
}
|
9492
9491
|
|
9493
9492
|
Queue.prototype.push = function (target, method, args, stack) {
|
@@ -9517,14 +9516,13 @@ enifed('backburner', ['exports'], function (exports) {
|
|
9517
9516
|
var _options = this.options,
|
9518
9517
|
before = _options.before,
|
9519
9518
|
after = _options.after,
|
9519
|
+
onError,
|
9520
9520
|
i;
|
9521
9521
|
|
9522
9522
|
var target = void 0;
|
9523
9523
|
var method = void 0;
|
9524
9524
|
var args = void 0;
|
9525
9525
|
var errorRecordedForStack = void 0;
|
9526
|
-
var onError = this.globalOptions.onError;
|
9527
|
-
var invoke = onError ? this.invokeWithOnError : this.invoke;
|
9528
9526
|
this.targetQueues = Object.create(null);
|
9529
9527
|
var queueItems = void 0;
|
9530
9528
|
if (this._queueBeingFlushed.length > 0) {
|
@@ -9536,33 +9534,39 @@ enifed('backburner', ['exports'], function (exports) {
|
|
9536
9534
|
if (before) {
|
9537
9535
|
before();
|
9538
9536
|
}
|
9539
|
-
|
9540
|
-
|
9541
|
-
|
9542
|
-
|
9543
|
-
|
9544
|
-
|
9545
|
-
|
9546
|
-
|
9547
|
-
|
9548
|
-
|
9549
|
-
//
|
9550
|
-
//
|
9551
|
-
|
9552
|
-
|
9553
|
-
|
9554
|
-
|
9555
|
-
|
9556
|
-
|
9557
|
-
|
9558
|
-
|
9559
|
-
|
9560
|
-
|
9561
|
-
|
9562
|
-
|
9563
|
-
|
9564
|
-
|
9565
|
-
|
9537
|
+
var invoke = void 0;
|
9538
|
+
if (queueItems.length > 0) {
|
9539
|
+
onError = getOnError(this.globalOptions);
|
9540
|
+
|
9541
|
+
invoke = onError ? this.invokeWithOnError : this.invoke;
|
9542
|
+
for (i = this.index; i < queueItems.length; i += 4) {
|
9543
|
+
this.index += 4;
|
9544
|
+
target = queueItems[i];
|
9545
|
+
method = queueItems[i + 1];
|
9546
|
+
args = queueItems[i + 2];
|
9547
|
+
errorRecordedForStack = queueItems[i + 3]; // Debugging assistance
|
9548
|
+
// method could have been nullified / canceled during flush
|
9549
|
+
if (method !== null) {
|
9550
|
+
//
|
9551
|
+
// ** Attention intrepid developer **
|
9552
|
+
//
|
9553
|
+
// To find out the stack of this task when it was scheduled onto
|
9554
|
+
// the run loop, add the following to your app.js:
|
9555
|
+
//
|
9556
|
+
// Ember.run.backburner.DEBUG = true; // NOTE: This slows your app, don't leave it on in production.
|
9557
|
+
//
|
9558
|
+
// Once that is in place, when you are at a breakpoint and navigate
|
9559
|
+
// here in the stack explorer, you can look at `errorRecordedForStack.stack`,
|
9560
|
+
// which will be the captured stack when this job was scheduled.
|
9561
|
+
//
|
9562
|
+
// One possible long-term solution is the following Chrome issue:
|
9563
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=332624
|
9564
|
+
//
|
9565
|
+
invoke(target, method, args, onError, errorRecordedForStack);
|
9566
|
+
}
|
9567
|
+
if (this.index !== this._queueBeingFlushed.length && this.globalOptions.mustYield && this.globalOptions.mustYield()) {
|
9568
|
+
return 1 /* Pause */;
|
9569
|
+
}
|
9566
9570
|
}
|
9567
9571
|
}
|
9568
9572
|
if (after) {
|
@@ -9773,7 +9777,6 @@ enifed('backburner', ['exports'], function (exports) {
|
|
9773
9777
|
|
9774
9778
|
// accepts a function that when invoked will return an iterator
|
9775
9779
|
// iterator will drain until completion
|
9776
|
-
// accepts a function that when invoked will return an iterator
|
9777
9780
|
var iteratorDrain = function (fn) {
|
9778
9781
|
var iterator = fn();
|
9779
9782
|
var result = iterator.next();
|
@@ -9783,7 +9786,6 @@ enifed('backburner', ['exports'], function (exports) {
|
|
9783
9786
|
}
|
9784
9787
|
};
|
9785
9788
|
|
9786
|
-
var now = Date.now;
|
9787
9789
|
var noop = function () {};
|
9788
9790
|
|
9789
9791
|
var Backburner = function () {
|
@@ -9824,6 +9826,9 @@ enifed('backburner', ['exports'], function (exports) {
|
|
9824
9826
|
return platform.setTimeout(fn, 0);
|
9825
9827
|
};
|
9826
9828
|
platform.clearNext = _platform.clearNext || platform.clearTimeout;
|
9829
|
+
platform.now = _platform.now || function () {
|
9830
|
+
return Date.now();
|
9831
|
+
};
|
9827
9832
|
this._platform = platform;
|
9828
9833
|
this._boundRunExpiredTimers = function () {
|
9829
9834
|
_this._runExpiredTimers();
|
@@ -10122,7 +10127,7 @@ enifed('backburner', ['exports'], function (exports) {
|
|
10122
10127
|
}
|
10123
10128
|
}
|
10124
10129
|
var onError = getOnError(this.options);
|
10125
|
-
var executeAt = now() + wait;
|
10130
|
+
var executeAt = this._platform.now() + wait;
|
10126
10131
|
var fn = void 0;
|
10127
10132
|
if (onError) {
|
10128
10133
|
fn = function () {
|
@@ -10342,7 +10347,7 @@ enifed('backburner', ['exports'], function (exports) {
|
|
10342
10347
|
var l = timers.length;
|
10343
10348
|
var i = 0;
|
10344
10349
|
var defaultQueue = this.options.defaultQueue;
|
10345
|
-
var n = now();
|
10350
|
+
var n = this._platform.now();
|
10346
10351
|
for (; i < l; i += 2) {
|
10347
10352
|
executeAt = timers[i];
|
10348
10353
|
|
@@ -10376,7 +10381,7 @@ enifed('backburner', ['exports'], function (exports) {
|
|
10376
10381
|
return;
|
10377
10382
|
}
|
10378
10383
|
var minExpiresAt = this._timers[0];
|
10379
|
-
var n = now();
|
10384
|
+
var n = this._platform.now();
|
10380
10385
|
var wait = Math.max(0, minExpiresAt - n);
|
10381
10386
|
this._timerTimeoutId = this._platform.setTimeout(this._boundRunExpiredTimers, wait);
|
10382
10387
|
};
|
@@ -10400,7 +10405,7 @@ enifed('backburner', ['exports'], function (exports) {
|
|
10400
10405
|
|
10401
10406
|
exports.default = Backburner;
|
10402
10407
|
});
|
10403
|
-
enifed('container', ['exports', 'ember-utils', 'ember-debug'
|
10408
|
+
enifed('container', ['exports', 'ember-utils', 'ember-debug'], function (exports, _emberUtils, _emberDebug) {
|
10404
10409
|
'use strict';
|
10405
10410
|
|
10406
10411
|
exports.Container = exports.privatize = exports.Registry = undefined;
|
@@ -10727,7 +10732,7 @@ enifed('container', ['exports', 'ember-utils', 'ember-debug', 'ember-environment
|
|
10727
10732
|
if (typeof this.class._initFactory === 'function') {
|
10728
10733
|
this.class._initFactory(this);
|
10729
10734
|
} else {
|
10730
|
-
// in the non-
|
10735
|
+
// in the non-EmberObject case we need to still setOwner
|
10731
10736
|
// this is required for supporting glimmer environment and
|
10732
10737
|
// template instantiation which rely heavily on
|
10733
10738
|
// `options[OWNER]` being passed into `create`
|
@@ -12631,7 +12636,7 @@ enifed('ember-application/system/engine-parent', ['exports', 'ember-utils'], fun
|
|
12631
12636
|
@param {EngineInstance} engine An engine instance.
|
12632
12637
|
@return {EngineInstance} The parent engine instance.
|
12633
12638
|
@for Ember
|
12634
|
-
@
|
12639
|
+
@private
|
12635
12640
|
*/
|
12636
12641
|
function (engine) {
|
12637
12642
|
return engine[ENGINE_PARENT];
|
@@ -12780,65 +12785,83 @@ enifed('ember-application/system/engine', ['exports', 'ember-babel', 'ember-util
|
|
12780
12785
|
* `name` allows you to specify under which name the initializer is registered.
|
12781
12786
|
This must be a unique name, as trying to register two initializers with the
|
12782
12787
|
same name will result in an error.
|
12783
|
-
```
|
12784
|
-
|
12785
|
-
|
12786
|
-
|
12787
|
-
|
12788
|
-
|
12789
|
-
|
12788
|
+
```app/initializer/named-initializer.js
|
12789
|
+
import { debug } from '@ember/debug';
|
12790
|
+
export function initialize() {
|
12791
|
+
debug('Running namedInitializer!');
|
12792
|
+
}
|
12793
|
+
export default {
|
12794
|
+
name: 'named-initializer',
|
12795
|
+
initialize
|
12796
|
+
};
|
12790
12797
|
```
|
12791
12798
|
* `before` and `after` are used to ensure that this initializer is ran prior
|
12792
12799
|
or after the one identified by the value. This value can be a single string
|
12793
12800
|
or an array of strings, referencing the `name` of other initializers.
|
12794
12801
|
An example of ordering initializers, we create an initializer named `first`:
|
12795
|
-
```
|
12796
|
-
|
12802
|
+
```app/initializer/first.js
|
12803
|
+
import { debug } from '@ember/debug';
|
12804
|
+
export function initialize() {
|
12805
|
+
debug('First initializer!');
|
12806
|
+
}
|
12807
|
+
export default {
|
12797
12808
|
name: 'first',
|
12798
|
-
|
12799
|
-
|
12800
|
-
|
12801
|
-
|
12802
|
-
|
12809
|
+
initialize
|
12810
|
+
};
|
12811
|
+
```
|
12812
|
+
```bash
|
12813
|
+
// DEBUG: First initializer!
|
12803
12814
|
```
|
12804
12815
|
We add another initializer named `second`, specifying that it should run
|
12805
12816
|
after the initializer named `first`:
|
12806
|
-
```
|
12807
|
-
|
12817
|
+
```app/initializer/second.js
|
12818
|
+
import { debug } from '@ember/debug';
|
12819
|
+
export function initialize() {
|
12820
|
+
debug('Second initializer!');
|
12821
|
+
}
|
12822
|
+
export default {
|
12808
12823
|
name: 'second',
|
12809
12824
|
after: 'first',
|
12810
|
-
|
12811
|
-
|
12812
|
-
|
12813
|
-
|
12814
|
-
|
12825
|
+
initialize
|
12826
|
+
};
|
12827
|
+
```
|
12828
|
+
```
|
12829
|
+
// DEBUG: First initializer!
|
12815
12830
|
// DEBUG: Second initializer!
|
12816
12831
|
```
|
12817
12832
|
Afterwards we add a further initializer named `pre`, this time specifying
|
12818
12833
|
that it should run before the initializer named `first`:
|
12819
|
-
```
|
12820
|
-
|
12834
|
+
```app/initializer/pre.js
|
12835
|
+
import { debug } from '@ember/debug';
|
12836
|
+
export function initialize() {
|
12837
|
+
debug('Pre initializer!');
|
12838
|
+
}
|
12839
|
+
export default {
|
12821
12840
|
name: 'pre',
|
12822
12841
|
before: 'first',
|
12823
|
-
|
12824
|
-
|
12825
|
-
|
12826
|
-
|
12827
|
-
|
12842
|
+
initialize
|
12843
|
+
};
|
12844
|
+
```
|
12845
|
+
```bash
|
12846
|
+
// DEBUG: Pre initializer!
|
12828
12847
|
// DEBUG: First initializer!
|
12829
12848
|
// DEBUG: Second initializer!
|
12830
12849
|
```
|
12831
12850
|
Finally we add an initializer named `post`, specifying it should run after
|
12832
12851
|
both the `first` and the `second` initializers:
|
12833
|
-
```
|
12834
|
-
|
12852
|
+
```app/initializer/post.js
|
12853
|
+
import { debug } from '@ember/debug';
|
12854
|
+
export function initialize() {
|
12855
|
+
debug('Post initializer!');
|
12856
|
+
}
|
12857
|
+
export default {
|
12835
12858
|
name: 'post',
|
12836
12859
|
after: ['first', 'second'],
|
12837
|
-
|
12838
|
-
|
12839
|
-
|
12840
|
-
|
12841
|
-
|
12860
|
+
initialize
|
12861
|
+
};
|
12862
|
+
```
|
12863
|
+
```bash
|
12864
|
+
// DEBUG: Pre initializer!
|
12842
12865
|
// DEBUG: First initializer!
|
12843
12866
|
// DEBUG: Second initializer!
|
12844
12867
|
// DEBUG: Post initializer!
|
@@ -12846,13 +12869,16 @@ enifed('ember-application/system/engine', ['exports', 'ember-babel', 'ember-util
|
|
12846
12869
|
* `initialize` is a callback function that receives one argument,
|
12847
12870
|
`application`, on which you can operate.
|
12848
12871
|
Example of using `application` to register an adapter:
|
12849
|
-
```
|
12850
|
-
|
12851
|
-
|
12852
|
-
|
12853
|
-
|
12854
|
-
|
12855
|
-
|
12872
|
+
```app/initializer/api-adapter.js
|
12873
|
+
import ApiAdapter from '../utils/api-adapter';
|
12874
|
+
export function initialize(application) {
|
12875
|
+
application.register('api-adapter:main', ApiAdapter);
|
12876
|
+
}
|
12877
|
+
export default {
|
12878
|
+
name: 'post',
|
12879
|
+
after: ['first', 'second'],
|
12880
|
+
initialize
|
12881
|
+
};
|
12856
12882
|
```
|
12857
12883
|
@method initializer
|
12858
12884
|
@param initializer {Object}
|
@@ -12872,13 +12898,15 @@ enifed('ember-application/system/engine', ['exports', 'ember-babel', 'ember-util
|
|
12872
12898
|
* `name` allows you to specify under which name the instanceInitializer is
|
12873
12899
|
registered. This must be a unique name, as trying to register two
|
12874
12900
|
instanceInitializer with the same name will result in an error.
|
12875
|
-
```
|
12876
|
-
|
12877
|
-
|
12878
|
-
|
12879
|
-
|
12880
|
-
|
12881
|
-
|
12901
|
+
```app/initializer/named-instance-initializer.js
|
12902
|
+
import { debug } from '@ember/debug';
|
12903
|
+
export function initialize() {
|
12904
|
+
debug('Running named-instance-initializer!');
|
12905
|
+
}
|
12906
|
+
export default {
|
12907
|
+
name: 'named-instance-initializer',
|
12908
|
+
initialize
|
12909
|
+
};
|
12882
12910
|
```
|
12883
12911
|
* `before` and `after` are used to ensure that this initializer is ran prior
|
12884
12912
|
or after the one identified by the value. This value can be a single string
|
@@ -12886,10 +12914,9 @@ enifed('ember-application/system/engine', ['exports', 'ember-babel', 'ember-util
|
|
12886
12914
|
* See Ember.Application.initializer for discussion on the usage of before
|
12887
12915
|
and after.
|
12888
12916
|
Example instanceInitializer to preload data into the store.
|
12889
|
-
```
|
12890
|
-
|
12891
|
-
|
12892
|
-
initialize: function(application) {
|
12917
|
+
```app/initializer/preload-data.js
|
12918
|
+
import $ from 'jquery';
|
12919
|
+
export function initialize(application) {
|
12893
12920
|
var userConfig, userConfigEncoded, store;
|
12894
12921
|
// We have a HTML escaped JSON representation of the user's basic
|
12895
12922
|
// configuration generated server side and stored in the DOM of the main
|
@@ -12898,17 +12925,19 @@ enifed('ember-application/system/engine', ['exports', 'ember-babel', 'ember-util
|
|
12898
12925
|
// needed for immediate rendering of the page. Keep in mind, this data,
|
12899
12926
|
// like all local models and data can be manipulated by the user, so it
|
12900
12927
|
// should not be relied upon for security or authorization.
|
12901
|
-
|
12902
|
-
|
12903
|
-
|
12904
|
-
// Unescape the text, then parse the resulting JSON into a real object
|
12928
|
+
// Grab the encoded data from the meta tag
|
12929
|
+
userConfigEncoded = $('head meta[name=app-user-config]').attr('content');
|
12930
|
+
// Unescape the text, then parse the resulting JSON into a real object
|
12905
12931
|
userConfig = JSON.parse(unescape(userConfigEncoded));
|
12906
|
-
|
12932
|
+
// Lookup the store
|
12907
12933
|
store = application.lookup('service:store');
|
12908
|
-
|
12934
|
+
// Push the encoded JSON into the store
|
12909
12935
|
store.pushPayload(userConfig);
|
12910
|
-
|
12911
|
-
|
12936
|
+
}
|
12937
|
+
export default {
|
12938
|
+
name: 'named-instance-initializer',
|
12939
|
+
initialize
|
12940
|
+
};
|
12912
12941
|
```
|
12913
12942
|
@method instanceInitializer
|
12914
12943
|
@param instanceInitializer
|
@@ -12936,7 +12965,7 @@ enifed('ember-application/system/engine', ['exports', 'ember-babel', 'ember-util
|
|
12936
12965
|
|
12937
12966
|
/**
|
12938
12967
|
Set this to provide an alternate class to `Ember.DefaultResolver`
|
12939
|
-
|
12968
|
+
@deprecated Use 'Resolver' instead
|
12940
12969
|
@property resolver
|
12941
12970
|
@public
|
12942
12971
|
*/
|
@@ -13091,12 +13120,16 @@ enifed('ember-application/system/resolver', ['exports', 'ember-utils', 'ember-me
|
|
13091
13120
|
in a subclass. For example, you could enhance how a template
|
13092
13121
|
is resolved like so:
|
13093
13122
|
|
13094
|
-
```
|
13095
|
-
|
13096
|
-
|
13097
|
-
|
13123
|
+
```app/app.js
|
13124
|
+
import Application from '@ember/application';
|
13125
|
+
import GlobalsResolver from '@ember/application/globals-resolver';
|
13126
|
+
|
13127
|
+
App = Application.create({
|
13128
|
+
Resolver: GlobalsResolver.extend({
|
13129
|
+
resolveTemplate(parsedName) {
|
13098
13130
|
let resolvedTemplate = this._super(parsedName);
|
13099
13131
|
if (resolvedTemplate) { return resolvedTemplate; }
|
13132
|
+
|
13100
13133
|
return Ember.TEMPLATES['not_found'];
|
13101
13134
|
}
|
13102
13135
|
})
|
@@ -13385,10 +13418,10 @@ enifed('ember-application/system/resolver', ['exports', 'ember-utils', 'ember-me
|
|
13385
13418
|
},
|
13386
13419
|
|
13387
13420
|
/**
|
13388
|
-
|
13389
|
-
|
13390
|
-
|
13391
|
-
|
13421
|
+
@method _logLookup
|
13422
|
+
@param {Boolean} found
|
13423
|
+
@param {Object} parsedName
|
13424
|
+
@private
|
13392
13425
|
*/
|
13393
13426
|
_logLookup: function (found, parsedName) {
|
13394
13427
|
var symbol = found ? '[✓]' : '[ ]';
|
@@ -13404,11 +13437,11 @@ enifed('ember-application/system/resolver', ['exports', 'ember-utils', 'ember-me
|
|
13404
13437
|
},
|
13405
13438
|
|
13406
13439
|
/**
|
13407
|
-
|
13408
|
-
|
13409
|
-
|
13410
|
-
|
13411
|
-
|
13440
|
+
Used to iterate all items of a given type.
|
13441
|
+
@method knownForType
|
13442
|
+
@param {String} type the type to search for
|
13443
|
+
@private
|
13444
|
+
*/
|
13412
13445
|
knownForType: function (type) {
|
13413
13446
|
var namespace = (0, _emberMetal.get)(this, 'namespace'),
|
13414
13447
|
index,
|
@@ -13435,16 +13468,15 @@ enifed('ember-application/system/resolver', ['exports', 'ember-utils', 'ember-me
|
|
13435
13468
|
},
|
13436
13469
|
|
13437
13470
|
/**
|
13438
|
-
|
13439
|
-
|
13440
|
-
|
13441
|
-
|
13442
|
-
|
13443
|
-
|
13444
|
-
|
13445
|
-
|
13446
|
-
|
13447
|
-
|
13471
|
+
Converts provided name from the backing namespace into a container lookup name.
|
13472
|
+
Examples:
|
13473
|
+
* App.FooBarHelper -> helper:foo-bar
|
13474
|
+
* App.THelper -> helper:t
|
13475
|
+
@method translateToContainerFullname
|
13476
|
+
@param {String} type
|
13477
|
+
@param {String} name
|
13478
|
+
@private
|
13479
|
+
*/
|
13448
13480
|
translateToContainerFullname: function (type, name) {
|
13449
13481
|
var suffix = _emberRuntime.String.classify(type);
|
13450
13482
|
var namePrefix = name.slice(0, suffix.length * -1);
|
@@ -15587,9 +15619,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15587
15619
|
`hello` for the `person-profile` component:
|
15588
15620
|
|
15589
15621
|
```app/components/person-profile.js
|
15590
|
-
import
|
15622
|
+
import Component from '@ember/component';
|
15591
15623
|
|
15592
|
-
export default
|
15624
|
+
export default Component.extend({
|
15593
15625
|
actions: {
|
15594
15626
|
hello(name) {
|
15595
15627
|
console.log("Hello", name);
|
@@ -15621,9 +15653,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15621
15653
|
The following component class:
|
15622
15654
|
|
15623
15655
|
```app/components/emphasized-paragraph.js
|
15624
|
-
import
|
15656
|
+
import Component from '@ember/component';
|
15625
15657
|
|
15626
|
-
export default
|
15658
|
+
export default Component.extend({
|
15627
15659
|
tagName: 'em'
|
15628
15660
|
});
|
15629
15661
|
```
|
@@ -15641,9 +15673,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15641
15673
|
`classNames` property that is set to an array of strings:
|
15642
15674
|
|
15643
15675
|
```app/components/my-widget.js
|
15644
|
-
import
|
15676
|
+
import Component from '@ember/component';
|
15645
15677
|
|
15646
|
-
export default
|
15678
|
+
export default Component.extend({
|
15647
15679
|
classNames: ['my-class', 'my-other-class']
|
15648
15680
|
});
|
15649
15681
|
```
|
@@ -15660,9 +15692,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15660
15692
|
attribute. These properties can be computed properties:
|
15661
15693
|
|
15662
15694
|
```app/components/my-widget.js
|
15663
|
-
import
|
15695
|
+
import Component from '@ember/component';
|
15664
15696
|
|
15665
|
-
export default
|
15697
|
+
export default Component.extend({
|
15666
15698
|
classNameBindings: ['propertyA', 'propertyB'],
|
15667
15699
|
propertyA: 'from-a',
|
15668
15700
|
propertyB: Ember.computed(function() {
|
@@ -15682,9 +15714,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15682
15714
|
The class name will not be added if the value is `false` or `undefined`.
|
15683
15715
|
|
15684
15716
|
```app/components/my-widget.js
|
15685
|
-
import
|
15717
|
+
import Component from '@ember/component';
|
15686
15718
|
|
15687
|
-
export default
|
15719
|
+
export default Component.extend({
|
15688
15720
|
classNameBindings: ['hovered'],
|
15689
15721
|
hovered: true
|
15690
15722
|
});
|
@@ -15701,9 +15733,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15701
15733
|
preferred value after a ":" character when defining the binding:
|
15702
15734
|
|
15703
15735
|
```app/components/my-widget.js
|
15704
|
-
import
|
15736
|
+
import Component from '@ember/component';
|
15705
15737
|
|
15706
|
-
export default
|
15738
|
+
export default Component.extend({
|
15707
15739
|
classNameBindings: ['awesome:so-very-cool'],
|
15708
15740
|
awesome: true
|
15709
15741
|
});
|
@@ -15719,9 +15751,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15719
15751
|
camelCase-style format will be converted to a dasherized format:
|
15720
15752
|
|
15721
15753
|
```app/components/my-widget.js
|
15722
|
-
import
|
15754
|
+
import Component from '@ember/component';
|
15723
15755
|
|
15724
|
-
export default
|
15756
|
+
export default Component.extend({
|
15725
15757
|
classNameBindings: ['isUrgent'],
|
15726
15758
|
isUrgent: true
|
15727
15759
|
});
|
@@ -15737,9 +15769,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15737
15769
|
traversing a path relative to the component itself:
|
15738
15770
|
|
15739
15771
|
```app/components/my-widget.js
|
15740
|
-
import
|
15772
|
+
import Component from '@ember/component';
|
15741
15773
|
|
15742
|
-
export default
|
15774
|
+
export default Component.extend({
|
15743
15775
|
classNameBindings: ['messages.empty'],
|
15744
15776
|
messages: Ember.Object.create({
|
15745
15777
|
empty: true
|
@@ -15758,9 +15790,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15758
15790
|
like this:
|
15759
15791
|
|
15760
15792
|
```app/components/my-widget.js
|
15761
|
-
import
|
15793
|
+
import Component from '@ember/component';
|
15762
15794
|
|
15763
|
-
export default
|
15795
|
+
export default Component.extend({
|
15764
15796
|
classNameBindings: ['isEnabled:enabled:disabled'],
|
15765
15797
|
isEnabled: true
|
15766
15798
|
});
|
@@ -15782,10 +15814,10 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15782
15814
|
This syntax offers the convenience to add a class if a property is `false`:
|
15783
15815
|
|
15784
15816
|
```app/components/my-widget.js
|
15785
|
-
import
|
15817
|
+
import Component from '@ember/component';
|
15786
15818
|
|
15787
15819
|
// Applies no class when isEnabled is true and class 'disabled' when isEnabled is false
|
15788
|
-
export default
|
15820
|
+
export default Component.extend({
|
15789
15821
|
classNameBindings: ['isEnabled::disabled'],
|
15790
15822
|
isEnabled: true
|
15791
15823
|
});
|
@@ -15821,9 +15853,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15821
15853
|
HTML associated attribute:
|
15822
15854
|
|
15823
15855
|
```app/components/my-anchor.js
|
15824
|
-
import
|
15856
|
+
import Component from '@ember/component';
|
15825
15857
|
|
15826
|
-
export default
|
15858
|
+
export default Component.extend({
|
15827
15859
|
tagName: 'a',
|
15828
15860
|
attributeBindings: ['href'],
|
15829
15861
|
href: 'http://google.com'
|
@@ -15840,9 +15872,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15840
15872
|
the source property and the destination property:
|
15841
15873
|
|
15842
15874
|
```app/components/my-anchor.js
|
15843
|
-
import
|
15875
|
+
import Component from '@ember/component';
|
15844
15876
|
|
15845
|
-
export default
|
15877
|
+
export default Component.extend({
|
15846
15878
|
tagName: 'a',
|
15847
15879
|
attributeBindings: ['url:href'],
|
15848
15880
|
url: 'http://google.com'
|
@@ -15859,9 +15891,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15859
15891
|
mapped, since `:` is not a valid character for properties in Javascript:
|
15860
15892
|
|
15861
15893
|
```app/components/my-use.js
|
15862
|
-
import
|
15894
|
+
import Component from '@ember/component';
|
15863
15895
|
|
15864
|
-
export default
|
15896
|
+
export default Component.extend({
|
15865
15897
|
tagName: 'use',
|
15866
15898
|
attributeBindings: ['xlinkHref:xlink:href'],
|
15867
15899
|
xlinkHref: '#triangle'
|
@@ -15878,9 +15910,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15878
15910
|
the attribute will be present or absent depending on the value:
|
15879
15911
|
|
15880
15912
|
```app/components/my-text-input.js
|
15881
|
-
import
|
15913
|
+
import Component from '@ember/component';
|
15882
15914
|
|
15883
|
-
export default
|
15915
|
+
export default Component.extend({
|
15884
15916
|
tagName: 'input',
|
15885
15917
|
attributeBindings: ['disabled'],
|
15886
15918
|
disabled: false
|
@@ -15896,9 +15928,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15896
15928
|
`attributeBindings` can refer to computed properties:
|
15897
15929
|
|
15898
15930
|
```app/components/my-text-input.js
|
15899
|
-
import
|
15931
|
+
import Component from '@ember/component';
|
15900
15932
|
|
15901
|
-
export default
|
15933
|
+
export default Component.extend({
|
15902
15934
|
tagName: 'input',
|
15903
15935
|
attributeBindings: ['disabled'],
|
15904
15936
|
disabled: Ember.computed(function() {
|
@@ -15915,9 +15947,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15915
15947
|
return value of the `attributeBindings` monitored property:
|
15916
15948
|
|
15917
15949
|
```app/components/my-text-input.js
|
15918
|
-
import
|
15950
|
+
import Component from '@ember/component';
|
15919
15951
|
|
15920
|
-
export default
|
15952
|
+
export default Component.extend({
|
15921
15953
|
tagName: 'form',
|
15922
15954
|
attributeBindings: ['novalidate'],
|
15923
15955
|
novalidate: null
|
@@ -15945,10 +15977,10 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15945
15977
|
```
|
15946
15978
|
|
15947
15979
|
```app/components/person-profile.js
|
15948
|
-
import
|
15980
|
+
import Component from '@ember/component';
|
15949
15981
|
import layout from '../templates/components/person-profile';
|
15950
15982
|
|
15951
|
-
export default
|
15983
|
+
export default Component.extend({
|
15952
15984
|
layout
|
15953
15985
|
});
|
15954
15986
|
```
|
@@ -15978,9 +16010,9 @@ enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'emb
|
|
15978
16010
|
argument to this method.
|
15979
16011
|
|
15980
16012
|
```app/components/my-widget.js
|
15981
|
-
import
|
16013
|
+
import Component from '@ember/component';
|
15982
16014
|
|
15983
|
-
export default
|
16015
|
+
export default Component.extend({
|
15984
16016
|
click(event) {
|
15985
16017
|
// will be called when an instance's
|
15986
16018
|
// rendered element is clicked
|
@@ -16870,13 +16902,13 @@ enifed('ember-glimmer/components/link-to', ['exports', 'ember-console', 'ember-d
|
|
16870
16902
|
|
16871
16903
|
### Allowing Default Action
|
16872
16904
|
|
16873
|
-
|
16874
|
-
|
16875
|
-
|
16876
|
-
|
16905
|
+
By default the `{{link-to}}` component prevents the default browser action
|
16906
|
+
by calling `preventDefault()` as this sort of action bubbling is normally
|
16907
|
+
handled internally and we do not want to take the browser to a new URL (for
|
16908
|
+
example).
|
16877
16909
|
|
16878
|
-
|
16879
|
-
|
16910
|
+
If you need to override this behavior specify `preventDefault=false` in
|
16911
|
+
your template:
|
16880
16912
|
|
16881
16913
|
```handlebars
|
16882
16914
|
{{#link-to 'photoGallery' aPhotoId preventDefault=false}}
|
@@ -17010,7 +17042,8 @@ enifed('ember-glimmer/components/text_field', ['exports', 'ember-metal', 'ember-
|
|
17010
17042
|
layout: _empty.default,
|
17011
17043
|
classNames: ['ember-text-field'],
|
17012
17044
|
tagName: 'input',
|
17013
|
-
attributeBindings: ['accept', 'autocomplete', 'autosave', 'dir', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'height', 'inputmode', 'lang', 'list', '
|
17045
|
+
attributeBindings: ['accept', 'autocomplete', 'autosave', 'dir', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'height', 'inputmode', 'lang', 'list', 'type', // needs to be before min and max. See #15675
|
17046
|
+
'max', 'min', 'multiple', 'name', 'pattern', 'size', 'step', 'value', 'width'],
|
17014
17047
|
|
17015
17048
|
/**
|
17016
17049
|
The `value` attribute of the input element. As the user inputs text, this
|
@@ -17397,9 +17430,10 @@ enifed('ember-glimmer/helper', ['exports', 'ember-utils', 'ember-runtime', '@gli
|
|
17397
17430
|
The `helper` method create pure-function helpers without instances. For
|
17398
17431
|
example:
|
17399
17432
|
|
17400
|
-
```js
|
17401
|
-
|
17402
|
-
|
17433
|
+
```app/helpers/format-currency.js
|
17434
|
+
import { helper } from '@ember/component/helper';
|
17435
|
+
|
17436
|
+
export default helper(function(params, hash) {
|
17403
17437
|
let cents = params[0];
|
17404
17438
|
let currency = hash.currency;
|
17405
17439
|
return `${currency}${cents * 0.01}`;
|
@@ -17438,8 +17472,10 @@ enifed('ember-glimmer/helper', ['exports', 'ember-utils', 'ember-runtime', '@gli
|
|
17438
17472
|
|
17439
17473
|
Helpers defined using a class must provide a `compute` function. For example:
|
17440
17474
|
|
17441
|
-
```js
|
17442
|
-
|
17475
|
+
```app/helpers/format-currency.js
|
17476
|
+
import Helper from '@ember/component/helper';
|
17477
|
+
|
17478
|
+
export default Helper.extend({
|
17443
17479
|
compute(params, hash) {
|
17444
17480
|
let cents = params[0];
|
17445
17481
|
let currency = hash.currency;
|
@@ -17678,10 +17714,10 @@ enifed('ember-glimmer/helpers/action', ['exports', 'ember-utils', 'ember-metal',
|
|
17678
17714
|
|
17679
17715
|
Here is an example action handler on a component:
|
17680
17716
|
|
17681
|
-
```js
|
17682
|
-
import
|
17717
|
+
```app/components/my-component.js
|
17718
|
+
import Component from '@ember/component';
|
17683
17719
|
|
17684
|
-
export default
|
17720
|
+
export default Component.extend({
|
17685
17721
|
actions: {
|
17686
17722
|
save() {
|
17687
17723
|
this.get('model').save();
|
@@ -17710,8 +17746,10 @@ enifed('ember-glimmer/helpers/action', ['exports', 'ember-utils', 'ember-metal',
|
|
17710
17746
|
additional arguments are passed to the action function. This has interesting
|
17711
17747
|
properties combined with currying of arguments. For example:
|
17712
17748
|
|
17713
|
-
```js
|
17714
|
-
|
17749
|
+
```app/components/my-component.js
|
17750
|
+
import Component from '@ember/component';
|
17751
|
+
|
17752
|
+
export default Component.extend({
|
17715
17753
|
actions: {
|
17716
17754
|
// Usage {{input on-input=(action (action 'setName' model) value="target.value")}}
|
17717
17755
|
setName(model, name) {
|
@@ -17730,9 +17768,9 @@ enifed('ember-glimmer/helpers/action', ['exports', 'ember-utils', 'ember-metal',
|
|
17730
17768
|
with `on-input` above. For example:
|
17731
17769
|
|
17732
17770
|
```app/components/my-input.js
|
17733
|
-
import
|
17771
|
+
import Component from '@ember/component';
|
17734
17772
|
|
17735
|
-
export default
|
17773
|
+
export default Component.extend({
|
17736
17774
|
actions: {
|
17737
17775
|
setName(model, name) {
|
17738
17776
|
model.set('name', name);
|
@@ -17746,9 +17784,9 @@ enifed('ember-glimmer/helpers/action', ['exports', 'ember-utils', 'ember-metal',
|
|
17746
17784
|
```
|
17747
17785
|
|
17748
17786
|
```app/components/my-component.js
|
17749
|
-
import
|
17787
|
+
import Component from '@ember/component';
|
17750
17788
|
|
17751
|
-
export default
|
17789
|
+
export default Component.extend({
|
17752
17790
|
click() {
|
17753
17791
|
// Note that model is not passed, it was curried in the template
|
17754
17792
|
this.sendAction('submit', 'bob');
|
@@ -17804,7 +17842,7 @@ enifed('ember-glimmer/helpers/action', ['exports', 'ember-utils', 'ember-metal',
|
|
17804
17842
|
```
|
17805
17843
|
|
17806
17844
|
```app/helpers/disable-bubbling.js
|
17807
|
-
import
|
17845
|
+
import { helper } from '@ember/component/helper';
|
17808
17846
|
|
17809
17847
|
export function disableBubbling([action]) {
|
17810
17848
|
return function(event) {
|
@@ -17812,7 +17850,7 @@ enifed('ember-glimmer/helpers/action', ['exports', 'ember-utils', 'ember-metal',
|
|
17812
17850
|
return action(event);
|
17813
17851
|
};
|
17814
17852
|
}
|
17815
|
-
export default
|
17853
|
+
export default helper(disableBubbling);
|
17816
17854
|
```
|
17817
17855
|
|
17818
17856
|
If you need the default handler to trigger you should either register your
|
@@ -17869,10 +17907,11 @@ enifed('ember-glimmer/helpers/action', ['exports', 'ember-utils', 'ember-metal',
|
|
17869
17907
|
```
|
17870
17908
|
|
17871
17909
|
```app/controllers/application.js
|
17872
|
-
import
|
17910
|
+
import Controller from '@ember/controller';
|
17911
|
+
import { inject as service } from '@ember/service';
|
17873
17912
|
|
17874
|
-
export default
|
17875
|
-
someService:
|
17913
|
+
export default Controller.extend({
|
17914
|
+
someService: service()
|
17876
17915
|
});
|
17877
17916
|
```
|
17878
17917
|
|
@@ -18313,7 +18352,7 @@ enifed('ember-glimmer/helpers/get', ['exports', 'ember-babel', 'ember-metal', 'e
|
|
18313
18352
|
var path = this.lastPath = this.pathReference.value();
|
18314
18353
|
|
18315
18354
|
if (path !== lastPath) {
|
18316
|
-
if (path) {
|
18355
|
+
if (path !== undefined && path !== null) {
|
18317
18356
|
pathType = typeof path;
|
18318
18357
|
|
18319
18358
|
|
@@ -20147,10 +20186,31 @@ enifed('ember-glimmer/syntax/mount', ['exports', 'ember-debug', 'ember-glimmer/s
|
|
20147
20186
|
{{mount "ember-chat"}}
|
20148
20187
|
```
|
20149
20188
|
|
20150
|
-
|
20151
|
-
|
20189
|
+
Additionally, you can also pass in a `model` argument that will be
|
20190
|
+
set as the engines model. This can be an existing object:
|
20191
|
+
|
20192
|
+
```
|
20193
|
+
<div>
|
20194
|
+
{{mount 'admin' model=userSettings}}
|
20195
|
+
</div>
|
20196
|
+
```
|
20197
|
+
|
20198
|
+
Or an inline `hash`, and you can even pass components:
|
20199
|
+
|
20200
|
+
```
|
20201
|
+
<div>
|
20202
|
+
<h1>Application template!</h1>
|
20203
|
+
{{mount 'admin' model=(hash
|
20204
|
+
title='Secret Admin'
|
20205
|
+
signInButton=(component 'sign-in-button')
|
20206
|
+
)}}
|
20207
|
+
</div>
|
20208
|
+
```
|
20152
20209
|
|
20153
20210
|
@method mount
|
20211
|
+
@param {String} name Name of the engine to mount.
|
20212
|
+
@param {Object} [model] Object that will be set as
|
20213
|
+
the model of the engine.
|
20154
20214
|
@for Ember.Templates.helpers
|
20155
20215
|
@category ember-application-engines
|
20156
20216
|
@public
|
@@ -20258,9 +20318,10 @@ enifed('ember-glimmer/syntax/outlet', ['exports', '@glimmer/reference', 'ember-g
|
|
20258
20318
|
Your routes can then render into a specific one of these `outlet`s by specifying the `outlet`
|
20259
20319
|
attribute in your `renderTemplate` function:
|
20260
20320
|
|
20261
|
-
```
|
20262
|
-
|
20263
|
-
|
20321
|
+
```app/routes/menu.js
|
20322
|
+
import Route from '@ember/routing/route';
|
20323
|
+
|
20324
|
+
export default Route.extend({
|
20264
20325
|
renderTemplate() {
|
20265
20326
|
this.render({ outlet: 'menu' });
|
20266
20327
|
}
|
@@ -20372,8 +20433,10 @@ enifed('ember-glimmer/syntax/render', ['exports', '@glimmer/reference', 'ember-d
|
|
20372
20433
|
|
20373
20434
|
Example:
|
20374
20435
|
|
20375
|
-
```
|
20376
|
-
|
20436
|
+
```app/controllers/navigation.js
|
20437
|
+
import Controller from '@ember/controller';
|
20438
|
+
|
20439
|
+
export default Controller.extend({
|
20377
20440
|
who: "world"
|
20378
20441
|
});
|
20379
20442
|
```
|
@@ -22906,7 +22969,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
22906
22969
|
|
22907
22970
|
|
22908
22971
|
function defineProperty(obj, keyName, desc, data, meta$$1) {
|
22909
|
-
if (meta$$1 ===
|
22972
|
+
if (meta$$1 === undefined) {
|
22910
22973
|
meta$$1 = meta(obj);
|
22911
22974
|
}
|
22912
22975
|
|
@@ -23008,7 +23071,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
23008
23071
|
isDescriptor;
|
23009
23072
|
|
23010
23073
|
// do nothing of this object has already been destroyed
|
23011
|
-
if (
|
23074
|
+
if (meta$$1 === undefined || meta$$1.isSourceDestroyed()) {
|
23012
23075
|
return;
|
23013
23076
|
}
|
23014
23077
|
|
@@ -23194,9 +23257,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
23194
23257
|
return;
|
23195
23258
|
}
|
23196
23259
|
|
23197
|
-
var meta$$1 = _meta
|
23260
|
+
var meta$$1 = _meta === undefined ? exports.peekMeta(obj) : _meta;
|
23198
23261
|
|
23199
|
-
if (
|
23262
|
+
if (meta$$1 === undefined || meta$$1.readableChainWatchers() === undefined) {
|
23200
23263
|
return;
|
23201
23264
|
}
|
23202
23265
|
|
@@ -24553,7 +24616,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
24553
24616
|
*/
|
24554
24617
|
function ComputedProperty(config, opts) {
|
24555
24618
|
this.isDescriptor = true;
|
24556
|
-
|
24619
|
+
var hasGetterOnly = typeof config === 'function';
|
24620
|
+
if (hasGetterOnly) {
|
24557
24621
|
this._getter = config;
|
24558
24622
|
} else {
|
24559
24623
|
false && !(typeof config === 'object' && !Array.isArray(config)) && emberDebug.assert('Ember.computed expects a function or an object as last argument.', typeof config === 'object' && !Array.isArray(config));
|
@@ -24571,8 +24635,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
24571
24635
|
this._suspended = undefined;
|
24572
24636
|
this._meta = undefined;
|
24573
24637
|
this._volatile = false;
|
24638
|
+
|
24574
24639
|
this._dependentKeys = opts && opts.dependentKeys;
|
24575
|
-
this._readOnly =
|
24640
|
+
this._readOnly = opts && hasGetterOnly && opts.readOnly === true;
|
24576
24641
|
}
|
24577
24642
|
|
24578
24643
|
ComputedProperty.prototype = new Descriptor();
|
@@ -24691,10 +24756,13 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
24691
24756
|
You can pass a hash of these values to a computed property like this:
|
24692
24757
|
|
24693
24758
|
```
|
24694
|
-
|
24759
|
+
import { computed } from '@ember/object';
|
24760
|
+
import Person from 'my-app/utils/person';
|
24761
|
+
|
24762
|
+
person: computed(function() {
|
24695
24763
|
let personId = this.get('personId');
|
24696
|
-
return
|
24697
|
-
}).meta({ type:
|
24764
|
+
return Person.create({ id: personId });
|
24765
|
+
}).meta({ type: Person })
|
24698
24766
|
```
|
24699
24767
|
|
24700
24768
|
The hash that you pass to the `meta()` function will be saved on the
|
@@ -24726,12 +24794,12 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
24726
24794
|
|
24727
24795
|
// don't create objects just to invalidate
|
24728
24796
|
var meta$$1 = exports.peekMeta(obj);
|
24729
|
-
if (
|
24797
|
+
if (meta$$1 === undefined || meta$$1.source !== obj) {
|
24730
24798
|
return;
|
24731
24799
|
}
|
24732
24800
|
|
24733
24801
|
var cache = meta$$1.readableCache();
|
24734
|
-
if (cache && cache[keyName] !== undefined) {
|
24802
|
+
if (cache !== undefined && cache[keyName] !== undefined) {
|
24735
24803
|
cache[keyName] = undefined;
|
24736
24804
|
removeDependentKeys(this, obj, keyName, meta$$1);
|
24737
24805
|
}
|
@@ -24753,14 +24821,10 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
24753
24821
|
}
|
24754
24822
|
|
24755
24823
|
var ret = this._getter.call(obj, keyName);
|
24756
|
-
|
24757
|
-
cache[keyName] = UNDEFINED;
|
24758
|
-
} else {
|
24759
|
-
cache[keyName] = ret;
|
24760
|
-
}
|
24824
|
+
cache[keyName] = ret === undefined ? UNDEFINED : ret;
|
24761
24825
|
|
24762
24826
|
var chainWatchers = meta$$1.readableChainWatchers();
|
24763
|
-
if (chainWatchers) {
|
24827
|
+
if (chainWatchers !== undefined) {
|
24764
24828
|
chainWatchers.revalidate(keyName);
|
24765
24829
|
}
|
24766
24830
|
addDependentKeys(this, obj, keyName, meta$$1);
|
@@ -24810,15 +24874,14 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
24810
24874
|
};
|
24811
24875
|
|
24812
24876
|
ComputedPropertyPrototype._set = function (obj, keyName, value) {
|
24813
|
-
// cache requires own meta
|
24814
24877
|
var meta$$1 = meta(obj);
|
24815
|
-
// either there is a writable cache or we need one to update
|
24816
24878
|
var cache = meta$$1.writableCache();
|
24817
24879
|
var hadCachedValue = false;
|
24818
24880
|
var cachedValue = void 0;
|
24819
|
-
|
24820
|
-
|
24821
|
-
|
24881
|
+
var val = cache[keyName];
|
24882
|
+
if (val !== undefined) {
|
24883
|
+
if (val !== UNDEFINED) {
|
24884
|
+
cachedValue = val;
|
24822
24885
|
}
|
24823
24886
|
hadCachedValue = true;
|
24824
24887
|
}
|
@@ -25319,22 +25382,20 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
25319
25382
|
};
|
25320
25383
|
|
25321
25384
|
var onerror = void 0;
|
25385
|
+
var onErrorTarget = {
|
25386
|
+
get onerror() {
|
25387
|
+
return dispatchOverride || onerror;
|
25388
|
+
}
|
25389
|
+
};
|
25390
|
+
|
25322
25391
|
// Ember.onerror getter
|
25323
25392
|
|
25324
25393
|
// Ember.onerror setter
|
25325
|
-
|
25326
|
-
onerror = handler;
|
25327
|
-
}
|
25394
|
+
|
25328
25395
|
|
25329
25396
|
var dispatchOverride = void 0;
|
25330
25397
|
// dispatch error
|
25331
|
-
|
25332
|
-
if (dispatchOverride) {
|
25333
|
-
dispatchOverride(error);
|
25334
|
-
} else {
|
25335
|
-
defaultDispatch(error);
|
25336
|
-
}
|
25337
|
-
}
|
25398
|
+
|
25338
25399
|
|
25339
25400
|
// allows testing adapter to override dispatch
|
25340
25401
|
|
@@ -25402,7 +25463,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
25402
25463
|
var meta$$1 = exports.peekMeta(obj),
|
25403
25464
|
map,
|
25404
25465
|
val;
|
25405
|
-
if (meta$$1) {
|
25466
|
+
if (meta$$1 !== undefined) {
|
25406
25467
|
map = meta$$1.readableWeak();
|
25407
25468
|
|
25408
25469
|
if (map !== undefined) {
|
@@ -25450,7 +25511,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
25450
25511
|
|
25451
25512
|
var meta$$1 = exports.peekMeta(obj),
|
25452
25513
|
map;
|
25453
|
-
if (meta$$1) {
|
25514
|
+
if (meta$$1 !== undefined) {
|
25454
25515
|
map = meta$$1.readableWeak();
|
25455
25516
|
|
25456
25517
|
if (map !== undefined) {
|
@@ -25637,15 +25698,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
25637
25698
|
*/
|
25638
25699
|
|
25639
25700
|
|
25640
|
-
var onErrorTarget = {
|
25641
|
-
get onerror() {
|
25642
|
-
return dispatchError;
|
25643
|
-
},
|
25644
|
-
set onerror(handler) {
|
25645
|
-
return setOnerror(handler);
|
25646
|
-
}
|
25647
|
-
};
|
25648
|
-
|
25649
25701
|
var backburner$1 = new Backburner(['sync', 'actions', 'destroy'], {
|
25650
25702
|
GUID_KEY: emberUtils.GUID_KEY,
|
25651
25703
|
sync: {
|
@@ -25757,16 +25809,26 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
25757
25809
|
We can use that setup option to do some additional setup for our component.
|
25758
25810
|
The component itself could look something like the following:
|
25759
25811
|
|
25760
|
-
```
|
25761
|
-
|
25812
|
+
```app/components/rich-text-editor.js
|
25813
|
+
import Component from '@ember/component';
|
25814
|
+
import { bind } from '@ember/runloop';
|
25815
|
+
|
25816
|
+
export default Component.extend({
|
25762
25817
|
initializeTinyMCE: Ember.on('didInsertElement', function() {
|
25763
25818
|
tinymce.init({
|
25764
25819
|
selector: '#' + this.$().prop('id'),
|
25765
25820
|
setup: Ember.run.bind(this, this.setupEditor)
|
25766
25821
|
});
|
25767
25822
|
}),
|
25823
|
+
|
25824
|
+
didInsertElement() {
|
25825
|
+
tinymce.init({
|
25826
|
+
selector: '#' + this.$().prop('id'),
|
25827
|
+
setup: Ember.run.bind(this, this.setupEditor)
|
25828
|
+
});
|
25829
|
+
}
|
25768
25830
|
|
25769
|
-
setupEditor
|
25831
|
+
setupEditor(editor) {
|
25770
25832
|
this.set('editor', editor);
|
25771
25833
|
|
25772
25834
|
editor.on('change', function() {
|
@@ -25777,7 +25839,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
25777
25839
|
```
|
25778
25840
|
|
25779
25841
|
In this example, we use Ember.run.bind to bind the setupEditor method to the
|
25780
|
-
context of the
|
25842
|
+
context of the RichTextEditor component and to have the invocation of that
|
25781
25843
|
method be safely handled and executed by the Ember run loop.
|
25782
25844
|
|
25783
25845
|
@method bind
|
@@ -26017,9 +26079,23 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
26017
26079
|
});
|
26018
26080
|
```
|
26019
26081
|
|
26020
|
-
Also note that
|
26021
|
-
|
26022
|
-
|
26082
|
+
Also note that for `run.scheduleOnce` to prevent additional calls, you need to
|
26083
|
+
pass the same function instance. The following case works as expected:
|
26084
|
+
|
26085
|
+
```javascript
|
26086
|
+
function log() {
|
26087
|
+
console.log('Logging only once');
|
26088
|
+
}
|
26089
|
+
|
26090
|
+
function scheduleIt() {
|
26091
|
+
run.scheduleOnce('actions', myContext, log);
|
26092
|
+
}
|
26093
|
+
|
26094
|
+
scheduleIt();
|
26095
|
+
scheduleIt();
|
26096
|
+
```
|
26097
|
+
|
26098
|
+
But this other case will schedule the function multiple times:
|
26023
26099
|
|
26024
26100
|
```javascript
|
26025
26101
|
function scheduleIt() {
|
@@ -26032,7 +26108,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
26032
26108
|
scheduleIt();
|
26033
26109
|
|
26034
26110
|
// "Closure" will print twice, even though we're using `run.scheduleOnce`,
|
26035
|
-
// because the function we pass to it
|
26111
|
+
// because the function we pass to it won't match the
|
26036
26112
|
// previously scheduled operation.
|
26037
26113
|
```
|
26038
26114
|
|
@@ -26080,8 +26156,10 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
26080
26156
|
|
26081
26157
|
Example:
|
26082
26158
|
|
26083
|
-
```
|
26084
|
-
|
26159
|
+
```app/components/my-component.js
|
26160
|
+
import Component from '@ember/component';
|
26161
|
+
|
26162
|
+
export Component.extend({
|
26085
26163
|
didInsertElement() {
|
26086
26164
|
this._super(...arguments);
|
26087
26165
|
run.scheduleOnce('afterRender', this, 'processChildElements');
|
@@ -27590,16 +27668,14 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
27590
27668
|
|
27591
27669
|
if (baseValue === null || baseValue === undefined) {
|
27592
27670
|
ret = emberUtils.makeArray(value);
|
27593
|
-
} else {
|
27594
|
-
if (
|
27595
|
-
|
27596
|
-
ret = baseValue;
|
27597
|
-
} else {
|
27598
|
-
ret = a_concat.call(baseValue, value);
|
27599
|
-
}
|
27671
|
+
} else if (isArray(baseValue)) {
|
27672
|
+
if (value === null || value === undefined) {
|
27673
|
+
ret = baseValue;
|
27600
27674
|
} else {
|
27601
|
-
ret = a_concat.call(
|
27675
|
+
ret = a_concat.call(baseValue, value);
|
27602
27676
|
}
|
27677
|
+
} else {
|
27678
|
+
ret = a_concat.call(emberUtils.makeArray(baseValue), value);
|
27603
27679
|
}
|
27604
27680
|
|
27605
27681
|
return ret;
|
@@ -27656,7 +27732,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
27656
27732
|
} else {
|
27657
27733
|
if (concats && concats.indexOf(key) >= 0 || key === 'concatenatedProperties' || key === 'mergedProperties') {
|
27658
27734
|
value = applyConcatenatedProperties(base, key, value, values);
|
27659
|
-
} else if (mergings && mergings.indexOf(key)
|
27735
|
+
} else if (mergings && mergings.indexOf(key) > -1) {
|
27660
27736
|
value = applyMergedProperties(base, key, value, values);
|
27661
27737
|
} else if (isMethod(value)) {
|
27662
27738
|
value = giveMethodSuper(base, key, value, values, descs);
|
@@ -27772,9 +27848,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
27772
27848
|
return { desc: desc, value: value };
|
27773
27849
|
}
|
27774
27850
|
|
27775
|
-
function updateObserversAndListeners(obj, key,
|
27776
|
-
var
|
27777
|
-
i;
|
27851
|
+
function updateObserversAndListeners(obj, key, paths, updateMethod) {
|
27852
|
+
var i;
|
27778
27853
|
|
27779
27854
|
if (paths) {
|
27780
27855
|
for (i = 0; i < paths.length; i++) {
|
@@ -27786,16 +27861,16 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
27786
27861
|
function replaceObserversAndListeners(obj, key, observerOrListener) {
|
27787
27862
|
var prev = obj[key];
|
27788
27863
|
|
27789
|
-
if ('function'
|
27790
|
-
updateObserversAndListeners(obj, key, prev
|
27791
|
-
updateObserversAndListeners(obj, key, prev
|
27792
|
-
updateObserversAndListeners(obj, key, prev
|
27864
|
+
if (typeof prev === 'function') {
|
27865
|
+
updateObserversAndListeners(obj, key, prev.__ember_observesBefore__, _removeBeforeObserver);
|
27866
|
+
updateObserversAndListeners(obj, key, prev.__ember_observes__, removeObserver);
|
27867
|
+
updateObserversAndListeners(obj, key, prev.__ember_listens__, removeListener);
|
27793
27868
|
}
|
27794
27869
|
|
27795
|
-
if ('function'
|
27796
|
-
updateObserversAndListeners(obj, key, observerOrListener
|
27797
|
-
updateObserversAndListeners(obj, key, observerOrListener
|
27798
|
-
updateObserversAndListeners(obj, key, observerOrListener
|
27870
|
+
if (typeof observerOrListener === 'function') {
|
27871
|
+
updateObserversAndListeners(obj, key, observerOrListener.__ember_observesBefore__, _addBeforeObserver);
|
27872
|
+
updateObserversAndListeners(obj, key, observerOrListener.__ember_observes__, addObserver);
|
27873
|
+
updateObserversAndListeners(obj, key, observerOrListener.__ember_listens__, addListener);
|
27799
27874
|
}
|
27800
27875
|
}
|
27801
27876
|
|
@@ -28007,7 +28082,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
28007
28082
|
Mixin.mixins = function (obj) {
|
28008
28083
|
var meta$$1 = exports.peekMeta(obj);
|
28009
28084
|
var ret = [];
|
28010
|
-
if (
|
28085
|
+
if (meta$$1 === undefined) {
|
28011
28086
|
return ret;
|
28012
28087
|
}
|
28013
28088
|
|
@@ -28116,7 +28191,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
28116
28191
|
return _detect(obj, this, {});
|
28117
28192
|
}
|
28118
28193
|
var meta$$1 = exports.peekMeta(obj);
|
28119
|
-
if (
|
28194
|
+
if (meta$$1 === undefined) {
|
28120
28195
|
return false;
|
28121
28196
|
}
|
28122
28197
|
return !!meta$$1.peekMixins(emberUtils.guidFor(this));
|
@@ -28194,15 +28269,21 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
28194
28269
|
/**
|
28195
28270
|
Makes a method available via an additional name.
|
28196
28271
|
|
28197
|
-
```
|
28198
|
-
|
28199
|
-
|
28272
|
+
```app/utils/person.js
|
28273
|
+
import EmberObject, {
|
28274
|
+
aliasMethod
|
28275
|
+
} from '@ember/object';
|
28276
|
+
|
28277
|
+
export default EmberObject.extend({
|
28278
|
+
name() {
|
28200
28279
|
return 'Tomhuda Katzdale';
|
28201
28280
|
},
|
28202
|
-
moniker:
|
28281
|
+
moniker: aliasMethod('name')
|
28203
28282
|
});
|
28283
|
+
```
|
28204
28284
|
|
28205
|
-
|
28285
|
+
```javascript
|
28286
|
+
let goodGuy = Person.create();
|
28206
28287
|
|
28207
28288
|
goodGuy.name(); // 'Tomhuda Katzdale'
|
28208
28289
|
goodGuy.moniker(); // 'Tomhuda Katzdale'
|
@@ -28533,8 +28614,16 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
28533
28614
|
exports.getOnerror = function () {
|
28534
28615
|
return onerror;
|
28535
28616
|
};
|
28536
|
-
exports.setOnerror =
|
28537
|
-
|
28617
|
+
exports.setOnerror = function (handler) {
|
28618
|
+
onerror = handler;
|
28619
|
+
};
|
28620
|
+
exports.dispatchError = function (error) {
|
28621
|
+
if (dispatchOverride) {
|
28622
|
+
dispatchOverride(error);
|
28623
|
+
} else {
|
28624
|
+
defaultDispatch(error);
|
28625
|
+
}
|
28626
|
+
};
|
28538
28627
|
exports.setDispatchOverride = function (handler) {
|
28539
28628
|
dispatchOverride = handler;
|
28540
28629
|
};
|
@@ -28561,7 +28650,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
28561
28650
|
exports.addListener = addListener;
|
28562
28651
|
exports.hasListeners = function (obj, eventName) {
|
28563
28652
|
var meta$$1 = exports.peekMeta(obj);
|
28564
|
-
if (
|
28653
|
+
if (meta$$1 === undefined) {
|
28565
28654
|
return false;
|
28566
28655
|
}
|
28567
28656
|
var matched = meta$$1.matchingListeners(eventName);
|
@@ -28577,8 +28666,16 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
28577
28666
|
_len,
|
28578
28667
|
args,
|
28579
28668
|
_key;
|
28669
|
+
var events = args;
|
28670
|
+
|
28671
|
+
false && !(typeof func === 'function') && emberDebug.assert('Ember.on expects function as last argument', typeof func === 'function');
|
28672
|
+
false && !(events.length > 0 && events.every(function (p) {
|
28673
|
+
return typeof p === 'string' && p.length;
|
28674
|
+
})) && emberDebug.assert('Ember.on called without valid event names', events.length > 0 && events.every(function (p) {
|
28675
|
+
return typeof p === 'string' && p.length;
|
28676
|
+
}));
|
28580
28677
|
|
28581
|
-
func.__ember_listens__ =
|
28678
|
+
func.__ember_listens__ = events;
|
28582
28679
|
return func;
|
28583
28680
|
};
|
28584
28681
|
exports.removeListener = removeListener;
|
@@ -28830,7 +28927,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
28830
28927
|
if (typeof value === 'object' && value !== null) {
|
28831
28928
|
meta$$1 = exports.peekMeta(value);
|
28832
28929
|
|
28833
|
-
return meta$$1
|
28930
|
+
return meta$$1 === undefined ? false : meta$$1.isProxy();
|
28834
28931
|
}
|
28835
28932
|
|
28836
28933
|
return false;
|
@@ -29503,14 +29600,14 @@ enifed('ember-routing/location/history_location', ['exports', 'ember-metal', 'em
|
|
29503
29600
|
|
29504
29601
|
Example:
|
29505
29602
|
|
29506
|
-
```
|
29507
|
-
|
29603
|
+
```app/router.js
|
29604
|
+
Router.map(function() {
|
29508
29605
|
this.route('posts', function() {
|
29509
29606
|
this.route('new');
|
29510
29607
|
});
|
29511
29608
|
});
|
29512
29609
|
|
29513
|
-
|
29610
|
+
Router.reopen({
|
29514
29611
|
location: 'history'
|
29515
29612
|
});
|
29516
29613
|
```
|
@@ -29981,9 +30078,91 @@ enifed('ember-routing/services/router', ['exports', 'ember-runtime', 'ember-rout
|
|
29981
30078
|
*/
|
29982
30079
|
|
29983
30080
|
var RouterService = _emberRuntime.Service.extend({
|
30081
|
+
|
30082
|
+
/**
|
30083
|
+
Name of the current route.
|
30084
|
+
This property represent the logical name of the route,
|
30085
|
+
which is comma separated.
|
30086
|
+
For the following router:
|
30087
|
+
```app/router.js
|
30088
|
+
Router.map(function() {
|
30089
|
+
this.route('about);
|
30090
|
+
this.route('blog', function () {
|
30091
|
+
this.route('post', { path: ':post_id' });
|
30092
|
+
});
|
30093
|
+
});
|
30094
|
+
```
|
30095
|
+
It will return:
|
30096
|
+
* `index` when you visit `/`
|
30097
|
+
* `about` when you visit `/about`
|
30098
|
+
* `blog.index` when you visit `/blog`
|
30099
|
+
* `blog.post` when you visit `/blog/some-post-id`
|
30100
|
+
@property currentRouteName
|
30101
|
+
@type String
|
30102
|
+
@public
|
30103
|
+
*/
|
29984
30104
|
currentRouteName: (0, _emberRuntime.readOnly)('_router.currentRouteName'),
|
30105
|
+
|
30106
|
+
/**
|
30107
|
+
Current URL for the application.
|
30108
|
+
This property represent the URL path for this route.
|
30109
|
+
For the following router:
|
30110
|
+
```app/router.js
|
30111
|
+
Router.map(function() {
|
30112
|
+
this.route('about);
|
30113
|
+
this.route('blog', function () {
|
30114
|
+
this.route('post', { path: ':post_id' });
|
30115
|
+
});
|
30116
|
+
});
|
30117
|
+
```
|
30118
|
+
It will return:
|
30119
|
+
* `/` when you visit `/`
|
30120
|
+
* `/about` when you visit `/about`
|
30121
|
+
* `/blog/index` when you visit `/blog`
|
30122
|
+
* `/blog/post` when you visit `/blog/some-post-id`
|
30123
|
+
@property currentURL
|
30124
|
+
@type String
|
30125
|
+
@public
|
30126
|
+
*/
|
29985
30127
|
currentURL: (0, _emberRuntime.readOnly)('_router.currentURL'),
|
30128
|
+
|
30129
|
+
/**
|
30130
|
+
The `location` property determines the type of URL's that your
|
30131
|
+
application will use.
|
30132
|
+
The following location types are currently available:
|
30133
|
+
* `auto`
|
30134
|
+
* `hash`
|
30135
|
+
* `history`
|
30136
|
+
* `none`
|
30137
|
+
@property location
|
30138
|
+
@default 'hash'
|
30139
|
+
@see {Ember.Location}
|
30140
|
+
@public
|
30141
|
+
*/
|
29986
30142
|
location: (0, _emberRuntime.readOnly)('_router.location'),
|
30143
|
+
|
30144
|
+
/**
|
30145
|
+
The `rootURL` property represents the URL of the root of
|
30146
|
+
the application, '/' by default.
|
30147
|
+
This prefix is assumed on all routes defined on this app.
|
30148
|
+
IF you change the `rootURL` in your environment configuration
|
30149
|
+
like so:
|
30150
|
+
```config/environment.js
|
30151
|
+
'use strict';
|
30152
|
+
module.exports = function(environment) {
|
30153
|
+
let ENV = {
|
30154
|
+
modulePrefix: 'router-service',
|
30155
|
+
environment,
|
30156
|
+
rootURL: '/my-root',
|
30157
|
+
…
|
30158
|
+
}
|
30159
|
+
]
|
30160
|
+
```
|
30161
|
+
This property will return `/my-root`.
|
30162
|
+
@property rootURL
|
30163
|
+
@default '/'
|
30164
|
+
@public
|
30165
|
+
*/
|
29987
30166
|
rootURL: (0, _emberRuntime.readOnly)('_router.rootURL'),
|
29988
30167
|
_router: null,
|
29989
30168
|
|
@@ -30838,10 +31017,10 @@ enifed('ember-routing/system/route', ['exports', 'ember-utils', 'ember-metal', '
|
|
30838
31017
|
A hook you can use to reset controller values either when the model
|
30839
31018
|
changes or the route is exiting.
|
30840
31019
|
```app/routes/articles.js
|
30841
|
-
import
|
30842
|
-
export default
|
31020
|
+
import Route from '@ember/routing/route';
|
31021
|
+
export default Route.extend({
|
30843
31022
|
resetController(controller, isExiting, transition) {
|
30844
|
-
if (isExiting) {
|
31023
|
+
if (isExiting && transition.targetName !== 'error') {
|
30845
31024
|
controller.set('page', 1);
|
30846
31025
|
}
|
30847
31026
|
}
|
@@ -30877,8 +31056,8 @@ enifed('ember-routing/system/route', ['exports', 'ember-utils', 'ember-metal', '
|
|
30877
31056
|
The name of the template to use by default when rendering this routes
|
30878
31057
|
template.
|
30879
31058
|
```app/routes/posts/list.js
|
30880
|
-
import
|
30881
|
-
export default
|
31059
|
+
import Route from '@ember/routing/route';
|
31060
|
+
export default Route.extend({
|
30882
31061
|
templateName: 'posts/list'
|
30883
31062
|
});
|
30884
31063
|
```
|
@@ -30924,8 +31103,8 @@ enifed('ember-routing/system/route', ['exports', 'ember-utils', 'ember-metal', '
|
|
30924
31103
|
A good example is preventing navigation when a form is
|
30925
31104
|
half-filled out:
|
30926
31105
|
```app/routes/contact-form.js
|
30927
|
-
import
|
30928
|
-
export default
|
31106
|
+
import Route from '@ember/routing/route';
|
31107
|
+
export default Route.extend({
|
30929
31108
|
actions: {
|
30930
31109
|
willTransition(transition) {
|
30931
31110
|
if (this.controller.get('userHasEnteredData')) {
|
@@ -30962,8 +31141,8 @@ enifed('ember-routing/system/route', ['exports', 'ember-utils', 'ember-metal', '
|
|
30962
31141
|
however, it can be useful for tracking page views or resetting
|
30963
31142
|
state on the controller.
|
30964
31143
|
```app/routes/login.js
|
30965
|
-
import
|
30966
|
-
export default
|
31144
|
+
import Route from '@ember/routing/route';
|
31145
|
+
export default Route.extend({
|
30967
31146
|
actions: {
|
30968
31147
|
didTransition() {
|
30969
31148
|
this.controller.get('errors.base').clear();
|
@@ -30983,7 +31162,8 @@ enifed('ember-routing/system/route', ['exports', 'ember-utils', 'ember-metal', '
|
|
30983
31162
|
`Transition` object is the first parameter and the route that
|
30984
31163
|
triggered the loading event is the second parameter.
|
30985
31164
|
```app/routes/application.js
|
30986
|
-
|
31165
|
+
import Route from '@ember/routing/route';
|
31166
|
+
export default Route.extend({
|
30987
31167
|
actions: {
|
30988
31168
|
loading(transition, route) {
|
30989
31169
|
let controller = this.controllerFor('foo');
|
@@ -31012,8 +31192,8 @@ enifed('ember-routing/system/route', ['exports', 'ember-utils', 'ember-metal', '
|
|
31012
31192
|
for rejected promises from the various hooks on the route,
|
31013
31193
|
as well as any unhandled errors from child routes:
|
31014
31194
|
```app/routes/admin.js
|
31015
|
-
import
|
31016
|
-
export default
|
31195
|
+
import Route from '@ember/routing/route';
|
31196
|
+
export default Route.extend({
|
31017
31197
|
beforeModel() {
|
31018
31198
|
return Ember.RSVP.reject('bad things!');
|
31019
31199
|
},
|
@@ -31037,8 +31217,8 @@ enifed('ember-routing/system/route', ['exports', 'ember-utils', 'ember-metal', '
|
|
31037
31217
|
specify your own global default error handler by overriding the
|
31038
31218
|
`error` handler on `ApplicationRoute`:
|
31039
31219
|
```app/routes/application.js
|
31040
|
-
import
|
31041
|
-
export default
|
31220
|
+
import Route from '@ember/routing/route';
|
31221
|
+
export default Route.extend({
|
31042
31222
|
actions: {
|
31043
31223
|
error(error, transition) {
|
31044
31224
|
this.controllerFor('banner').displayError(error.message);
|
@@ -31057,8 +31237,8 @@ enifed('ember-routing/system/route', ['exports', 'ember-utils', 'ember-metal', '
|
|
31057
31237
|
This event is triggered when the router enters the route. It is
|
31058
31238
|
not executed when the model for the route changes.
|
31059
31239
|
```app/routes/application.js
|
31060
|
-
import
|
31061
|
-
export default
|
31240
|
+
import Route from '@ember/routing/route';
|
31241
|
+
export default Route.extend({
|
31062
31242
|
collectAnalytics: Ember.on('activate', function(){
|
31063
31243
|
collectAnalytics();
|
31064
31244
|
})
|
@@ -31073,8 +31253,8 @@ enifed('ember-routing/system/route', ['exports', 'ember-utils', 'ember-metal', '
|
|
31073
31253
|
This event is triggered when the router completely exits this
|
31074
31254
|
route. It is not executed when the model for the route changes.
|
31075
31255
|
```app/routes/index.js
|
31076
|
-
import
|
31077
|
-
export default
|
31256
|
+
import Route from '@ember/routing/route';
|
31257
|
+
export default Route.extend({
|
31078
31258
|
trackPageLeaveAnalytics: Ember.on('deactivate', function(){
|
31079
31259
|
trackPageLeaveAnalytics();
|
31080
31260
|
})
|
@@ -31089,8 +31269,8 @@ enifed('ember-routing/system/route', ['exports', 'ember-utils', 'ember-metal', '
|
|
31089
31269
|
The controller associated with this route.
|
31090
31270
|
Example
|
31091
31271
|
```app/routes/form.js
|
31092
|
-
import
|
31093
|
-
export default
|
31272
|
+
import Route from '@ember/routing/route';
|
31273
|
+
export default Route.extend({
|
31094
31274
|
actions: {
|
31095
31275
|
willTransition(transition) {
|
31096
31276
|
if (this.controller.get('userHasEnteredData') &&
|
@@ -31406,8 +31586,8 @@ enifed('ember-routing/system/route', ['exports', 'ember-utils', 'ember-metal', '
|
|
31406
31586
|
logic that can only take place after the model has already
|
31407
31587
|
resolved.
|
31408
31588
|
```app/routes/posts.js
|
31409
|
-
import
|
31410
|
-
export default
|
31589
|
+
import Route from '@ember/routing/route';
|
31590
|
+
export default Route.extend({
|
31411
31591
|
afterModel(posts, transition) {
|
31412
31592
|
if (posts.get('length') === 1) {
|
31413
31593
|
this.transitionTo('post.show', posts.get('firstObject'));
|
@@ -31546,8 +31726,8 @@ enifed('ember-routing/system/route', ['exports', 'ember-utils', 'ember-metal', '
|
|
31546
31726
|
});
|
31547
31727
|
```
|
31548
31728
|
```app/routes/post.js
|
31549
|
-
import
|
31550
|
-
export default
|
31729
|
+
import Route from '@ember/routing/route';
|
31730
|
+
export default Route.extend({
|
31551
31731
|
model(params) {
|
31552
31732
|
// the server returns `{ id: 12 }`
|
31553
31733
|
return Ember.$.getJSON('/posts/' + params.post_id);
|
@@ -31970,7 +32150,7 @@ enifed('ember-routing/system/router', ['exports', 'ember-utils', 'ember-console'
|
|
31970
32150
|
* `hash` - use `#` to separate the server part of the URL from the Ember part: `/blog/#/posts/new`
|
31971
32151
|
* `none` - do not store the Ember URL in the actual browser URL (mainly used for testing)
|
31972
32152
|
* `auto` - use the best option based on browser capabilities: `history` if possible, then `hash` if possible, otherwise `none`
|
31973
|
-
|
32153
|
+
This value is defaulted to `auto` by the `locationType` setting of `/config/environment.js`
|
31974
32154
|
@property location
|
31975
32155
|
@default 'hash'
|
31976
32156
|
@see {Ember.Location}
|
@@ -32819,6 +32999,9 @@ enifed('ember-routing/system/router', ['exports', 'ember-utils', 'ember-console'
|
|
32819
32999
|
errorRouteName = findRouteStateName(route, 'error');
|
32820
33000
|
|
32821
33001
|
if (errorRouteName) {
|
33002
|
+
_errorId = (0, _emberUtils.guidFor)(error);
|
33003
|
+
|
33004
|
+
router._markErrorAsHandled(_errorId);
|
32822
33005
|
router.intermediateTransitionTo(errorRouteName, error);
|
32823
33006
|
return false;
|
32824
33007
|
}
|
@@ -32826,8 +33009,13 @@ enifed('ember-routing/system/router', ['exports', 'ember-utils', 'ember-console'
|
|
32826
33009
|
|
32827
33010
|
// Check for an 'error' substate route
|
32828
33011
|
var errorSubstateName = findRouteSubstateName(route, 'error'),
|
32829
|
-
errorRouteName
|
33012
|
+
errorRouteName,
|
33013
|
+
_errorId,
|
33014
|
+
errorId;
|
32830
33015
|
if (errorSubstateName) {
|
33016
|
+
errorId = (0, _emberUtils.guidFor)(error);
|
33017
|
+
|
33018
|
+
router._markErrorAsHandled(errorId);
|
32831
33019
|
router.intermediateTransitionTo(errorSubstateName, error);
|
32832
33020
|
return false;
|
32833
33021
|
}
|
@@ -34735,7 +34923,7 @@ enifed('ember-runtime/computed/reduce_computed_macros', ['exports', 'ember-utils
|
|
34735
34923
|
@public
|
34736
34924
|
*/
|
34737
34925
|
function (dependentKey, propertyKey) {
|
34738
|
-
|
34926
|
+
var cp = new _emberMetal.ComputedProperty(function () {
|
34739
34927
|
var uniq = (0, _native_array.A)();
|
34740
34928
|
var seen = Object.create(null);
|
34741
34929
|
var list = (0, _emberMetal.get)(this, dependentKey);
|
@@ -34749,7 +34937,9 @@ enifed('ember-runtime/computed/reduce_computed_macros', ['exports', 'ember-utils
|
|
34749
34937
|
});
|
34750
34938
|
}
|
34751
34939
|
return uniq;
|
34752
|
-
}
|
34940
|
+
}, { dependentKeys: [dependentKey + '.[]'], readOnly: true });
|
34941
|
+
|
34942
|
+
return cp;
|
34753
34943
|
}
|
34754
34944
|
|
34755
34945
|
/**
|
@@ -34892,7 +35082,7 @@ enifed('ember-runtime/computed/reduce_computed_macros', ['exports', 'ember-utils
|
|
34892
35082
|
exports.setDiff = function (setAProperty, setBProperty) {
|
34893
35083
|
false && !(arguments.length === 2) && (0, _emberDebug.assert)('Ember.computed.setDiff requires exactly two dependent arrays.', arguments.length === 2);
|
34894
35084
|
|
34895
|
-
|
35085
|
+
var cp = new _emberMetal.ComputedProperty(function () {
|
34896
35086
|
var setA = this.get(setAProperty);
|
34897
35087
|
var setB = this.get(setBProperty);
|
34898
35088
|
|
@@ -34906,7 +35096,12 @@ enifed('ember-runtime/computed/reduce_computed_macros', ['exports', 'ember-utils
|
|
34906
35096
|
return setA.filter(function (x) {
|
34907
35097
|
return setB.indexOf(x) === -1;
|
34908
35098
|
});
|
34909
|
-
}
|
35099
|
+
}, {
|
35100
|
+
dependentKeys: [setAProperty + '.[]', setBProperty + '.[]'],
|
35101
|
+
readOnly: true
|
35102
|
+
});
|
35103
|
+
|
35104
|
+
return cp;
|
34910
35105
|
}
|
34911
35106
|
|
34912
35107
|
/**
|
@@ -35046,9 +35241,9 @@ enifed('ember-runtime/computed/reduce_computed_macros', ['exports', 'ember-utils
|
|
35046
35241
|
return initialValue;
|
35047
35242
|
}
|
35048
35243
|
return arr.reduce(callback, initialValue, this);
|
35049
|
-
}, { dependentKeys: [dependentKey + '.[]'] });
|
35244
|
+
}, { dependentKeys: [dependentKey + '.[]'], readOnly: true });
|
35050
35245
|
|
35051
|
-
return cp
|
35246
|
+
return cp;
|
35052
35247
|
}
|
35053
35248
|
|
35054
35249
|
function arrayMacro(dependentKey, callback) {
|
@@ -35068,9 +35263,9 @@ enifed('ember-runtime/computed/reduce_computed_macros', ['exports', 'ember-utils
|
|
35068
35263
|
} else {
|
35069
35264
|
return (0, _native_array.A)();
|
35070
35265
|
}
|
35071
|
-
}, { dependentKeys: [dependentKey] });
|
35266
|
+
}, { dependentKeys: [dependentKey], readOnly: true });
|
35072
35267
|
|
35073
|
-
return cp
|
35268
|
+
return cp;
|
35074
35269
|
}
|
35075
35270
|
|
35076
35271
|
function multiArrayMacro(_dependentKeys, callback) {
|
@@ -35080,9 +35275,9 @@ enifed('ember-runtime/computed/reduce_computed_macros', ['exports', 'ember-utils
|
|
35080
35275
|
|
35081
35276
|
var cp = new _emberMetal.ComputedProperty(function () {
|
35082
35277
|
return (0, _native_array.A)(callback.call(this, _dependentKeys));
|
35083
|
-
}, { dependentKeys: dependentKeys });
|
35278
|
+
}, { dependentKeys: dependentKeys, readOnly: true });
|
35084
35279
|
|
35085
|
-
return cp
|
35280
|
+
return cp;
|
35086
35281
|
}function map(dependentKey, callback) {
|
35087
35282
|
return arrayMacro(dependentKey, function (value) {
|
35088
35283
|
return value.map(callback, this);
|
@@ -35175,11 +35370,11 @@ enifed('ember-runtime/computed/reduce_computed_macros', ['exports', 'ember-utils
|
|
35175
35370
|
activeObserversMap.set(this, activeObservers);
|
35176
35371
|
|
35177
35372
|
return sortByNormalizedSortProperties(items, normalizedSortProperties);
|
35178
|
-
}, { dependentKeys: [sortPropertiesKey + '.[]'] });
|
35373
|
+
}, { dependentKeys: [sortPropertiesKey + '.[]'], readOnly: true });
|
35179
35374
|
|
35180
35375
|
cp._activeObserverMap = undefined;
|
35181
35376
|
|
35182
|
-
return cp
|
35377
|
+
return cp;
|
35183
35378
|
}
|
35184
35379
|
|
35185
35380
|
function normalizeSortProperties(sortProperties) {
|
@@ -35206,7 +35401,6 @@ enifed('ember-runtime/computed/reduce_computed_macros', ['exports', 'ember-utils
|
|
35206
35401
|
return direction === 'desc' ? -1 * result : result;
|
35207
35402
|
}
|
35208
35403
|
}
|
35209
|
-
|
35210
35404
|
return 0;
|
35211
35405
|
}));
|
35212
35406
|
}
|
@@ -35237,9 +35431,13 @@ enifed('ember-runtime/controllers/controller', ['exports', 'ember-debug', 'ember
|
|
35237
35431
|
|
35238
35432
|
Example:
|
35239
35433
|
|
35240
|
-
```
|
35241
|
-
|
35242
|
-
|
35434
|
+
```app/controllers/post.js
|
35435
|
+
import Controller, {
|
35436
|
+
inject as controller
|
35437
|
+
} from '@ember/controller';
|
35438
|
+
|
35439
|
+
export default Controller.extend({
|
35440
|
+
posts: controller()
|
35243
35441
|
});
|
35244
35442
|
```
|
35245
35443
|
|
@@ -35247,10 +35445,13 @@ enifed('ember-runtime/controllers/controller', ['exports', 'ember-debug', 'ember
|
|
35247
35445
|
looks up the `posts` controller in the container, making it easy to
|
35248
35446
|
reference other controllers. This is functionally equivalent to:
|
35249
35447
|
|
35250
|
-
```
|
35251
|
-
|
35448
|
+
```app/controllers/post.js
|
35449
|
+
import Controller from '@ember/controller';
|
35450
|
+
import { alias } from '@ember/object/computed';
|
35451
|
+
|
35452
|
+
export default Controller.extend({
|
35252
35453
|
needs: 'posts',
|
35253
|
-
posts:
|
35454
|
+
posts: alias('controllers.posts')
|
35254
35455
|
});
|
35255
35456
|
```
|
35256
35457
|
|
@@ -35378,15 +35579,18 @@ enifed('ember-runtime/ext/function', ['ember-environment', 'ember-metal', 'ember
|
|
35378
35579
|
when `EmberENV.EXTEND_PROTOTYPES` or `EmberENV.EXTEND_PROTOTYPES.Function` is
|
35379
35580
|
`true`, which is the default.
|
35380
35581
|
Computed properties allow you to treat a function like a property:
|
35381
|
-
```
|
35382
|
-
|
35582
|
+
```app/utils/president.js
|
35583
|
+
import EmberObject from '@ember/object';
|
35584
|
+
export default EmberObject.extend({
|
35383
35585
|
firstName: '',
|
35384
35586
|
lastName: '',
|
35385
35587
|
fullName: function() {
|
35386
35588
|
return this.get('firstName') + ' ' + this.get('lastName');
|
35387
35589
|
}.property() // Call this flag to mark the function as a property
|
35388
35590
|
});
|
35389
|
-
|
35591
|
+
```
|
35592
|
+
```javascript
|
35593
|
+
let president = President.create({
|
35390
35594
|
firstName: 'Barack',
|
35391
35595
|
lastName: 'Obama'
|
35392
35596
|
});
|
@@ -35398,8 +35602,9 @@ enifed('ember-runtime/ext/function', ['ember-environment', 'ember-metal', 'ember
|
|
35398
35602
|
example, in the above example, the `fullName` property depends on
|
35399
35603
|
`firstName` and `lastName` to determine its value. You can tell Ember
|
35400
35604
|
about these dependencies like this:
|
35401
|
-
```
|
35402
|
-
|
35605
|
+
```app/utils/president.js
|
35606
|
+
import EmberObject from '@ember/object';
|
35607
|
+
export default EmberObject.extend({
|
35403
35608
|
firstName: '',
|
35404
35609
|
lastName: '',
|
35405
35610
|
fullName: function() {
|
@@ -35431,7 +35636,8 @@ enifed('ember-runtime/ext/function', ['ember-environment', 'ember-metal', 'ember
|
|
35431
35636
|
call to the end of your method declarations in classes that you write.
|
35432
35637
|
For example:
|
35433
35638
|
```javascript
|
35434
|
-
|
35639
|
+
import EmberObject from '@ember/object';
|
35640
|
+
EmberObject.extend({
|
35435
35641
|
valueObserver: function() {
|
35436
35642
|
// Executes whenever the "value" property changes
|
35437
35643
|
}.observes('value')
|
@@ -35478,7 +35684,8 @@ enifed('ember-runtime/ext/function', ['ember-environment', 'ember-metal', 'ember
|
|
35478
35684
|
call to the end of your method declarations in classes that you write.
|
35479
35685
|
For example:
|
35480
35686
|
```javascript
|
35481
|
-
|
35687
|
+
import EmberObject from '@ember/object';
|
35688
|
+
EmberObject.extend({
|
35482
35689
|
valueObserver: function() {
|
35483
35690
|
// Executes immediately after the "value" property changes
|
35484
35691
|
}.observesImmediately('value')
|
@@ -35501,7 +35708,8 @@ enifed('ember-runtime/ext/function', ['ember-environment', 'ember-metal', 'ember
|
|
35501
35708
|
You can listen for events simply by adding the `on` call to the end of
|
35502
35709
|
your method declarations in classes or mixins that you write. For example:
|
35503
35710
|
```javascript
|
35504
|
-
|
35711
|
+
import Mixin from '@ember/mixin';
|
35712
|
+
Mixin.create({
|
35505
35713
|
doSomethingWithElement: function() {
|
35506
35714
|
// Executes whenever the "didInsertElement" event fires
|
35507
35715
|
}.on('didInsertElement')
|
@@ -36507,7 +36715,7 @@ enifed('ember-runtime/mixins/array', ['exports', 'ember-utils', 'ember-metal', '
|
|
36507
36715
|
exports.arrayContentWillChange = arrayContentWillChange;
|
36508
36716
|
exports.arrayContentDidChange = arrayContentDidChange;
|
36509
36717
|
exports.isEmberArray = function (obj) {
|
36510
|
-
return obj &&
|
36718
|
+
return obj && obj[EMBER_ARRAY];
|
36511
36719
|
}
|
36512
36720
|
|
36513
36721
|
// ..........................................................
|
@@ -36582,11 +36790,7 @@ enifed('ember-runtime/mixins/array', ['exports', 'ember-utils', 'ember-metal', '
|
|
36582
36790
|
}
|
36583
36791
|
|
36584
36792
|
function objectAt(content, idx) {
|
36585
|
-
|
36586
|
-
return content.objectAt(idx);
|
36587
|
-
}
|
36588
|
-
|
36589
|
-
return content[idx];
|
36793
|
+
return typeof content.objectAt === 'function' ? content.objectAt(idx) : content[idx];
|
36590
36794
|
}
|
36591
36795
|
|
36592
36796
|
function arrayContentWillChange(array, startIdx, removeAmt, addAmt) {
|
@@ -36674,7 +36878,7 @@ enifed('ember-runtime/mixins/array', ['exports', 'ember-utils', 'ember-metal', '
|
|
36674
36878
|
(0, _emberMetal.sendEvent)(array, '@array:change', [array, startIdx, removeAmt, addAmt]);
|
36675
36879
|
|
36676
36880
|
var meta = (0, _emberMetal.peekMeta)(array);
|
36677
|
-
var cache = meta
|
36881
|
+
var cache = meta !== undefined ? meta.readableCache() : undefined;
|
36678
36882
|
if (cache !== undefined) {
|
36679
36883
|
length = (0, _emberMetal.get)(array, 'length');
|
36680
36884
|
addedAmount = addAmt === -1 ? 0 : addAmt;
|
@@ -36736,17 +36940,13 @@ enifed('ember-runtime/mixins/array', ['exports', 'ember-utils', 'ember-metal', '
|
|
36736
36940
|
|
36737
36941
|
if ((0, _emberMetal.isNone)(beginIndex)) {
|
36738
36942
|
beginIndex = 0;
|
36943
|
+
} else if (beginIndex < 0) {
|
36944
|
+
beginIndex = length + beginIndex;
|
36739
36945
|
}
|
36740
36946
|
|
36741
36947
|
if ((0, _emberMetal.isNone)(endIndex) || endIndex > length) {
|
36742
36948
|
endIndex = length;
|
36743
|
-
}
|
36744
|
-
|
36745
|
-
if (beginIndex < 0) {
|
36746
|
-
beginIndex = length + beginIndex;
|
36747
|
-
}
|
36748
|
-
|
36749
|
-
if (endIndex < 0) {
|
36949
|
+
} else if (endIndex < 0) {
|
36750
36950
|
endIndex = length + endIndex;
|
36751
36951
|
}
|
36752
36952
|
|
@@ -37743,22 +37943,22 @@ enifed('ember-runtime/mixins/evented', ['exports', 'ember-metal'], function (exp
|
|
37743
37943
|
exports.default = _emberMetal.Mixin.create({
|
37744
37944
|
|
37745
37945
|
/**
|
37746
|
-
|
37747
|
-
|
37748
|
-
|
37749
|
-
|
37750
|
-
|
37751
|
-
|
37752
|
-
|
37753
|
-
|
37754
|
-
|
37755
|
-
|
37756
|
-
|
37757
|
-
|
37758
|
-
|
37759
|
-
|
37760
|
-
|
37761
|
-
|
37946
|
+
Subscribes to a named event with given function.
|
37947
|
+
```javascript
|
37948
|
+
person.on('didLoad', function() {
|
37949
|
+
// fired once the person has loaded
|
37950
|
+
});
|
37951
|
+
```
|
37952
|
+
An optional target can be passed in as the 2nd argument that will
|
37953
|
+
be set as the "this" for the callback. This is a good way to give your
|
37954
|
+
function access to the object triggering the event. When the target
|
37955
|
+
parameter is used the callback becomes the third argument.
|
37956
|
+
@method on
|
37957
|
+
@param {String} name The name of the event
|
37958
|
+
@param {Object} [target] The "this" binding for the callback
|
37959
|
+
@param {Function} method The callback to execute
|
37960
|
+
@return this
|
37961
|
+
@public
|
37762
37962
|
*/
|
37763
37963
|
on: function (name, target, method) {
|
37764
37964
|
(0, _emberMetal.addListener)(this, name, target, method);
|
@@ -38589,8 +38789,9 @@ enifed('ember-runtime/mixins/observable', ['exports', 'ember-metal', 'ember-debu
|
|
38589
38789
|
observer should be prepared to handle that.
|
38590
38790
|
### Observer Methods
|
38591
38791
|
Observer methods have the following signature:
|
38592
|
-
```
|
38593
|
-
|
38792
|
+
```app/components/my-component.js
|
38793
|
+
import Component from '@ember/component';
|
38794
|
+
export default Component.extend({
|
38594
38795
|
init() {
|
38595
38796
|
this._super(...arguments);
|
38596
38797
|
this.addObserver('foo', this, 'fooDidChange');
|
@@ -38779,7 +38980,7 @@ enifed('ember-runtime/mixins/promise_proxy', ['exports', 'ember-metal', 'ember-d
|
|
38779
38980
|
let ObjectPromiseProxy = Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);
|
38780
38981
|
|
38781
38982
|
let proxy = ObjectPromiseProxy.create({
|
38782
|
-
promise: Ember.RSVP.
|
38983
|
+
promise: Ember.RSVP.resolve($.getJSON('/some/remote/data.json'))
|
38783
38984
|
});
|
38784
38985
|
|
38785
38986
|
proxy.then(function(json){
|
@@ -38802,7 +39003,7 @@ enifed('ember-runtime/mixins/promise_proxy', ['exports', 'ember-metal', 'ember-d
|
|
38802
39003
|
When the $.getJSON completes, and the promise is fulfilled
|
38803
39004
|
with json, the life cycle attributes will update accordingly.
|
38804
39005
|
Note that $.getJSON doesn't return an ECMA specified promise,
|
38805
|
-
it is useful to wrap this with an `RSVP.
|
39006
|
+
it is useful to wrap this with an `RSVP.resolve` so that it behaves
|
38806
39007
|
as a spec compliant promise.
|
38807
39008
|
|
38808
39009
|
```javascript
|
@@ -40483,8 +40684,10 @@ enifed('ember-runtime/system/native_array', ['exports', 'ember-metal', 'ember-en
|
|
40483
40684
|
|
40484
40685
|
Example
|
40485
40686
|
|
40486
|
-
```js
|
40487
|
-
|
40687
|
+
```app/components/my-component.js
|
40688
|
+
import Component from '@ember/component';
|
40689
|
+
|
40690
|
+
export default Component.extend({
|
40488
40691
|
tagName: 'ul',
|
40489
40692
|
classNames: ['pagination'],
|
40490
40693
|
|
@@ -40600,9 +40803,12 @@ enifed('ember-runtime/system/service', ['exports', 'ember-runtime/system/object'
|
|
40600
40803
|
|
40601
40804
|
Example:
|
40602
40805
|
|
40603
|
-
```
|
40604
|
-
|
40605
|
-
|
40806
|
+
```app/routes/application.js
|
40807
|
+
import Route from '@ember/routing/route';
|
40808
|
+
import { inject as service } from '@ember/service';
|
40809
|
+
|
40810
|
+
export default Route.extend({
|
40811
|
+
authManager: service('auth'),
|
40606
40812
|
|
40607
40813
|
model() {
|
40608
40814
|
return this.get('authManager').findCurrentUser();
|
@@ -41288,17 +41494,20 @@ enifed('ember-utils', ['exports'], function (exports) {
|
|
41288
41494
|
`audioType` passed as an attribute:
|
41289
41495
|
|
41290
41496
|
```app/components/play-audio.js
|
41291
|
-
import
|
41292
|
-
|
41497
|
+
import Component from '@ember/component';
|
41498
|
+
import { computed } from '@ember/object';
|
41499
|
+
import { getOwner } from '@ember/application';
|
41500
|
+
|
41293
41501
|
// Usage:
|
41294
41502
|
//
|
41295
41503
|
// {{play-audio audioType=model.audioType audioFile=model.file}}
|
41296
41504
|
//
|
41297
|
-
export default
|
41298
|
-
audioService:
|
41299
|
-
let owner =
|
41505
|
+
export default Component.extend({
|
41506
|
+
audioService: computed('audioType', function() {
|
41507
|
+
let owner = getOwner(this);
|
41300
41508
|
return owner.lookup(`service:${this.get('audioType')}`);
|
41301
41509
|
}),
|
41510
|
+
|
41302
41511
|
click() {
|
41303
41512
|
let player = this.get('audioService');
|
41304
41513
|
player.play(this.get('audioFile'));
|
@@ -41804,7 +42013,7 @@ enifed('ember-utils', ['exports'], function (exports) {
|
|
41804
42013
|
exports.canInvoke = canInvoke;
|
41805
42014
|
exports.tryInvoke = function (obj, methodName, args) {
|
41806
42015
|
if (canInvoke(obj, methodName)) {
|
41807
|
-
return
|
42016
|
+
return applyStr(obj, methodName, args);
|
41808
42017
|
}
|
41809
42018
|
};
|
41810
42019
|
exports.makeArray = function (obj) {
|
@@ -42036,9 +42245,9 @@ enifed('ember-views/mixins/action_support', ['exports', 'ember-utils', 'ember-me
|
|
42036
42245
|
For example a component for playing or pausing music may translate click events
|
42037
42246
|
into action notifications of "play" or "stop" depending on some internal state
|
42038
42247
|
of the component:
|
42039
|
-
```
|
42040
|
-
|
42041
|
-
|
42248
|
+
```app/components/play-button.js
|
42249
|
+
import Component from '@ember/component';
|
42250
|
+
export default Component.extend({
|
42042
42251
|
click() {
|
42043
42252
|
if (this.get('isPlaying')) {
|
42044
42253
|
this.sendAction('play');
|
@@ -42056,9 +42265,9 @@ enifed('ember-views/mixins/action_support', ['exports', 'ember-utils', 'ember-me
|
|
42056
42265
|
When the component receives a browser `click` event it translate this
|
42057
42266
|
interaction into application-specific semantics ("play" or "stop") and
|
42058
42267
|
calls the specified action.
|
42059
|
-
```
|
42060
|
-
|
42061
|
-
|
42268
|
+
```app/controller/application.js
|
42269
|
+
import Controller from '@ember/controller';
|
42270
|
+
export default Controller.extend({
|
42062
42271
|
actions: {
|
42063
42272
|
musicStarted() {
|
42064
42273
|
// called when the play button is clicked
|
@@ -42073,9 +42282,9 @@ enifed('ember-views/mixins/action_support', ['exports', 'ember-utils', 'ember-me
|
|
42073
42282
|
```
|
42074
42283
|
If no action is passed to `sendAction` a default name of "action"
|
42075
42284
|
is assumed.
|
42076
|
-
```
|
42077
|
-
|
42078
|
-
|
42285
|
+
```app/components/next-button.js
|
42286
|
+
import Component from '@ember/component';
|
42287
|
+
export default Component.extend({
|
42079
42288
|
click() {
|
42080
42289
|
this.sendAction();
|
42081
42290
|
}
|
@@ -42085,9 +42294,9 @@ enifed('ember-views/mixins/action_support', ['exports', 'ember-utils', 'ember-me
|
|
42085
42294
|
{{! app/templates/application.hbs }}
|
42086
42295
|
{{next-button action=(action "playNextSongInAlbum")}}
|
42087
42296
|
```
|
42088
|
-
```
|
42089
|
-
|
42090
|
-
|
42297
|
+
```app/controllers/application.js
|
42298
|
+
import Controller from '@ember/controller';
|
42299
|
+
export default Controller.extend({
|
42091
42300
|
actions: {
|
42092
42301
|
playNextSongInAlbum() {
|
42093
42302
|
...
|
@@ -42623,8 +42832,9 @@ enifed('ember-views/mixins/view_support', ['exports', 'ember-utils', 'ember-meta
|
|
42623
42832
|
is a string value, the value of that string will be applied as the value
|
42624
42833
|
for an attribute of the property's name.
|
42625
42834
|
The following example creates a tag like `<div priority="high" />`.
|
42626
|
-
```
|
42627
|
-
|
42835
|
+
```app/components/my-component.js
|
42836
|
+
import Component from '@ember/component';
|
42837
|
+
export default Component.extend({
|
42628
42838
|
attributeBindings: ['priority'],
|
42629
42839
|
priority: 'high'
|
42630
42840
|
});
|
@@ -42633,8 +42843,9 @@ enifed('ember-views/mixins/view_support', ['exports', 'ember-utils', 'ember-meta
|
|
42633
42843
|
an HTML Boolean attribute. It will be present if the property is `true`
|
42634
42844
|
and omitted if the property is `false`.
|
42635
42845
|
The following example creates markup like `<div visible />`.
|
42636
|
-
```
|
42637
|
-
|
42846
|
+
```app/components/my-component.js
|
42847
|
+
import Component from '@ember/component';
|
42848
|
+
export default Component.extend({
|
42638
42849
|
attributeBindings: ['visible'],
|
42639
42850
|
visible: true
|
42640
42851
|
});
|
@@ -42642,8 +42853,9 @@ enifed('ember-views/mixins/view_support', ['exports', 'ember-utils', 'ember-meta
|
|
42642
42853
|
If you would prefer to use a custom value instead of the property name,
|
42643
42854
|
you can create the same markup as the last example with a binding like
|
42644
42855
|
this:
|
42645
|
-
```
|
42646
|
-
|
42856
|
+
```app/components/my-component.js
|
42857
|
+
import Component from '@ember/component';
|
42858
|
+
export default Component.extend({
|
42647
42859
|
attributeBindings: ['isVisible:visible'],
|
42648
42860
|
isVisible: true
|
42649
42861
|
});
|
@@ -43962,15 +44174,15 @@ enifed('ember/index', ['exports', 'require', 'ember-environment', 'node-module',
|
|
43962
44174
|
computed.collect = _emberRuntime.collect;
|
43963
44175
|
|
43964
44176
|
/**
|
43965
|
-
|
43966
|
-
|
43967
|
-
|
44177
|
+
Defines the hash of localized strings for the current language. Used by
|
44178
|
+
the `Ember.String.loc()` helper. To localize, add string values to this
|
44179
|
+
hash.
|
43968
44180
|
|
43969
|
-
|
43970
|
-
|
43971
|
-
|
43972
|
-
|
43973
|
-
|
44181
|
+
@property STRINGS
|
44182
|
+
@for Ember
|
44183
|
+
@type Object
|
44184
|
+
@private
|
44185
|
+
*/
|
43974
44186
|
Object.defineProperty(_emberMetal.default, 'STRINGS', {
|
43975
44187
|
configurable: false,
|
43976
44188
|
get: _emberRuntime.getStrings,
|
@@ -43978,19 +44190,19 @@ enifed('ember/index', ['exports', 'require', 'ember-environment', 'node-module',
|
|
43978
44190
|
});
|
43979
44191
|
|
43980
44192
|
/**
|
43981
|
-
|
44193
|
+
Whether searching on the global for new Namespace instances is enabled.
|
43982
44194
|
|
43983
|
-
|
43984
|
-
|
43985
|
-
|
44195
|
+
This is only exported here as to not break any addons. Given the new
|
44196
|
+
visit API, you will have issues if you treat this as a indicator of
|
44197
|
+
booted.
|
43986
44198
|
|
43987
|
-
|
44199
|
+
Internally this is only exposing a flag in Namespace.
|
43988
44200
|
|
43989
|
-
|
43990
|
-
|
43991
|
-
|
43992
|
-
|
43993
|
-
|
44201
|
+
@property BOOTED
|
44202
|
+
@for Ember
|
44203
|
+
@type Boolean
|
44204
|
+
@private
|
44205
|
+
*/
|
43994
44206
|
Object.defineProperty(_emberMetal.default, 'BOOTED', {
|
43995
44207
|
configurable: false,
|
43996
44208
|
enumerable: false,
|
@@ -44027,15 +44239,15 @@ enifed('ember/index', ['exports', 'require', 'ember-environment', 'node-module',
|
|
44027
44239
|
_emberRuntime.String.isHTMLSafe = _emberGlimmer.isHTMLSafe;
|
44028
44240
|
|
44029
44241
|
/**
|
44030
|
-
|
44031
|
-
|
44032
|
-
|
44242
|
+
Global hash of shared templates. This will automatically be populated
|
44243
|
+
by the build tools so that you can store your Handlebars templates in
|
44244
|
+
separate files that get loaded into JavaScript at buildtime.
|
44033
44245
|
|
44034
|
-
|
44035
|
-
|
44036
|
-
|
44037
|
-
|
44038
|
-
|
44246
|
+
@property TEMPLATES
|
44247
|
+
@for Ember
|
44248
|
+
@type Object
|
44249
|
+
@private
|
44250
|
+
*/
|
44039
44251
|
Object.defineProperty(_emberMetal.default, 'TEMPLATES', {
|
44040
44252
|
get: _emberGlimmer.getTemplates,
|
44041
44253
|
set: _emberGlimmer.setTemplates,
|
@@ -44046,11 +44258,12 @@ enifed('ember/index', ['exports', 'require', 'ember-environment', 'node-module',
|
|
44046
44258
|
exports.VERSION = _version.default;
|
44047
44259
|
|
44048
44260
|
/**
|
44049
|
-
|
44050
|
-
|
44051
|
-
|
44052
|
-
|
44053
|
-
|
44261
|
+
The semantic version
|
44262
|
+
|
44263
|
+
@property VERSION
|
44264
|
+
@type String
|
44265
|
+
@public
|
44266
|
+
*/
|
44054
44267
|
_emberMetal.default.VERSION = _version.default;
|
44055
44268
|
|
44056
44269
|
_emberMetal.libraries.registerCoreLibrary('Ember', _version.default);
|
@@ -44058,13 +44271,14 @@ enifed('ember/index', ['exports', 'require', 'ember-environment', 'node-module',
|
|
44058
44271
|
// require the main entry points for each of these packages
|
44059
44272
|
// this is so that the global exports occur properly
|
44060
44273
|
|
44274
|
+
|
44061
44275
|
/**
|
44062
|
-
|
44276
|
+
Alias for jQuery
|
44063
44277
|
|
44064
|
-
|
44065
|
-
|
44066
|
-
|
44067
|
-
|
44278
|
+
@method $
|
44279
|
+
@for Ember
|
44280
|
+
@public
|
44281
|
+
*/
|
44068
44282
|
_emberMetal.default.$ = _emberViews.jQuery;
|
44069
44283
|
|
44070
44284
|
_emberMetal.default.ViewTargetActionSupport = _emberViews.ViewTargetActionSupport;
|
@@ -44125,7 +44339,7 @@ enifed('ember/index', ['exports', 'require', 'ember-environment', 'node-module',
|
|
44125
44339
|
(0, _emberRuntime.runLoadHooks)('Ember');
|
44126
44340
|
|
44127
44341
|
/**
|
44128
|
-
|
44342
|
+
@module ember
|
44129
44343
|
*/
|
44130
44344
|
exports.default = _emberMetal.default;
|
44131
44345
|
|
@@ -44139,7 +44353,7 @@ enifed('ember/index', ['exports', 'require', 'ember-environment', 'node-module',
|
|
44139
44353
|
enifed("ember/version", ["exports"], function (exports) {
|
44140
44354
|
"use strict";
|
44141
44355
|
|
44142
|
-
exports.default = "2.16.0-beta.
|
44356
|
+
exports.default = "2.16.0-beta.2";
|
44143
44357
|
});
|
44144
44358
|
enifed('node-module', ['exports'], function(_exports) {
|
44145
44359
|
var IS_NODE = typeof module === 'object' && typeof module.require === 'function';
|