ember-source 2.18.0.beta.3 → 2.18.0.beta.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dist/ember-runtime.js +86 -52
- data/dist/ember-template-compiler.js +87 -53
- data/dist/ember-testing.js +1 -1
- data/dist/ember-tests.js +1 -1
- data/dist/ember-tests.prod.js +1 -1
- data/dist/ember.debug.js +89 -55
- data/dist/ember.min.js +3 -3
- data/dist/ember.prod.js +89 -55
- data/package.json +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48093a35443606928ee14ca9446abfe51911144c3a0f0bf5f7c34fd89f6ce3fb
|
4
|
+
data.tar.gz: 8ad78f4957c8817a3a70c071333788842f9ef81454493733d4e7d0341b09e472
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 758e941cceaf90b0413de8bcd909f61096c248bde45f75f1f3867fef5410d5992bd08e2a5f939526b745d05b3dec951a72e7af857f63cc0dabd38a80335ad692
|
7
|
+
data.tar.gz: 8d5b94e865ee17fac805a99d4e756cb719c8c4662ebd00748a3df83134c8a246983f16c5870e41636cc349ce0b32d7abf462a70a372170d8178f65498d72e4f3
|
data/dist/ember-runtime.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.18.0-beta.
|
9
|
+
* @version 2.18.0-beta.4
|
10
10
|
*/
|
11
11
|
|
12
12
|
/*global process */
|
@@ -3113,7 +3113,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
3113
3113
|
|
3114
3114
|
if (counter === 1) {
|
3115
3115
|
m.writeWatching(keyPath, 0);
|
3116
|
-
m.
|
3116
|
+
m.writableChains(makeChainNode).remove(keyPath);
|
3117
3117
|
} else if (counter > 1) {
|
3118
3118
|
m.writeWatching(keyPath, counter - 1);
|
3119
3119
|
}
|
@@ -3346,11 +3346,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
3346
3346
|
if (paths === undefined) {
|
3347
3347
|
return;
|
3348
3348
|
}
|
3349
|
-
|
3350
3349
|
if (paths[path] > 0) {
|
3351
3350
|
paths[path]--;
|
3352
|
-
} else {
|
3353
|
-
return;
|
3354
3351
|
}
|
3355
3352
|
|
3356
3353
|
var key = firstKey(path);
|
@@ -5805,14 +5802,15 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
5805
5802
|
call.
|
5806
5803
|
|
5807
5804
|
```javascript
|
5805
|
+
import { run } from '@ember/runloop';
|
5806
|
+
|
5808
5807
|
run(function() {
|
5809
5808
|
// code to be executed within a RunLoop
|
5810
5809
|
});
|
5811
5810
|
```
|
5812
|
-
|
5813
|
-
@
|
5811
|
+
@method run
|
5812
|
+
@for @ember/runloop
|
5814
5813
|
@static
|
5815
|
-
@constructor
|
5816
5814
|
@param {Object} [target] target of method to call
|
5817
5815
|
@param {Function|String} method Method to invoke.
|
5818
5816
|
May be a function or a string. If you pass a string
|
@@ -5835,7 +5833,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
5835
5833
|
If invoked when not within a run loop:
|
5836
5834
|
|
5837
5835
|
```javascript
|
5838
|
-
|
5836
|
+
import { join } from '@ember/runloop';
|
5837
|
+
|
5838
|
+
join(function() {
|
5839
5839
|
// creates a new run-loop
|
5840
5840
|
});
|
5841
5841
|
```
|
@@ -5843,9 +5843,12 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
5843
5843
|
Alternatively, if called within an existing run loop:
|
5844
5844
|
|
5845
5845
|
```javascript
|
5846
|
+
import { run, join } from '@ember/runloop';
|
5847
|
+
|
5846
5848
|
run(function() {
|
5847
5849
|
// creates a new run-loop
|
5848
|
-
|
5850
|
+
|
5851
|
+
join(function() {
|
5849
5852
|
// joins with the existing run-loop, and queues for invocation on
|
5850
5853
|
// the existing run-loops action queue.
|
5851
5854
|
});
|
@@ -5874,7 +5877,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
5874
5877
|
makes this method a great way to asynchronously integrate third-party libraries
|
5875
5878
|
into your Ember application.
|
5876
5879
|
|
5877
|
-
`
|
5880
|
+
`bind` takes two main arguments, the desired context and the function to
|
5878
5881
|
invoke in that context. Any additional arguments will be supplied as arguments
|
5879
5882
|
to the function that is passed in.
|
5880
5883
|
|
@@ -5886,10 +5889,11 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
5886
5889
|
|
5887
5890
|
```app/components/rich-text-editor.js
|
5888
5891
|
import Component from '@ember/component';
|
5892
|
+
import { on } from '@ember/object/evented';
|
5889
5893
|
import { bind } from '@ember/runloop';
|
5890
5894
|
|
5891
5895
|
export default Component.extend({
|
5892
|
-
initializeTinyMCE:
|
5896
|
+
initializeTinyMCE: on('didInsertElement', function() {
|
5893
5897
|
tinymce.init({
|
5894
5898
|
selector: '#' + this.$().prop('id'),
|
5895
5899
|
setup: Ember.run.bind(this, this.setupEditor)
|
@@ -5953,9 +5957,11 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
5953
5957
|
a lower-level way to use a RunLoop instead of using `run()`.
|
5954
5958
|
|
5955
5959
|
```javascript
|
5956
|
-
|
5960
|
+
import { begin, end } from '@ember/runloop';
|
5961
|
+
|
5962
|
+
begin();
|
5957
5963
|
// code to be executed within a RunLoop
|
5958
|
-
|
5964
|
+
end();
|
5959
5965
|
```
|
5960
5966
|
|
5961
5967
|
@method begin
|
@@ -5974,9 +5980,11 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
5974
5980
|
to use a RunLoop instead of using `run()`.
|
5975
5981
|
|
5976
5982
|
```javascript
|
5977
|
-
|
5983
|
+
import { begin, end } from '@ember/runloop';
|
5984
|
+
|
5985
|
+
begin();
|
5978
5986
|
// code to be executed within a RunLoop
|
5979
|
-
|
5987
|
+
end();
|
5980
5988
|
```
|
5981
5989
|
|
5982
5990
|
@method end
|
@@ -6012,12 +6020,14 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
6012
6020
|
the `run.queues` property.
|
6013
6021
|
|
6014
6022
|
```javascript
|
6015
|
-
|
6023
|
+
import { schedule } from '@ember/runloop';
|
6024
|
+
|
6025
|
+
schedule('sync', this, function() {
|
6016
6026
|
// this will be executed in the first RunLoop queue, when bindings are synced
|
6017
6027
|
console.log('scheduled on sync queue');
|
6018
6028
|
});
|
6019
6029
|
|
6020
|
-
|
6030
|
+
schedule('actions', this, function() {
|
6021
6031
|
// this will be executed in the 'actions' queue, after bindings have synced.
|
6022
6032
|
console.log('scheduled on actions queue');
|
6023
6033
|
});
|
@@ -6093,7 +6103,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
6093
6103
|
together, which is often more efficient than using a real setTimeout.
|
6094
6104
|
|
6095
6105
|
```javascript
|
6096
|
-
|
6106
|
+
import { later } from '@ember/runloop';
|
6107
|
+
|
6108
|
+
later(myContext, function() {
|
6097
6109
|
// code here will execute within a RunLoop in about 500ms with this == myContext
|
6098
6110
|
}, 500);
|
6099
6111
|
```
|
@@ -6150,13 +6162,15 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
6150
6162
|
calls.
|
6151
6163
|
|
6152
6164
|
```javascript
|
6165
|
+
import { run, scheduleOnce } from '@ember/runloop';
|
6166
|
+
|
6153
6167
|
function sayHi() {
|
6154
6168
|
console.log('hi');
|
6155
6169
|
}
|
6156
6170
|
|
6157
6171
|
run(function() {
|
6158
|
-
|
6159
|
-
|
6172
|
+
scheduleOnce('afterRender', myContext, sayHi);
|
6173
|
+
scheduleOnce('afterRender', myContext, sayHi);
|
6160
6174
|
// sayHi will only be executed once, in the afterRender queue of the RunLoop
|
6161
6175
|
});
|
6162
6176
|
```
|
@@ -6170,7 +6184,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
6170
6184
|
}
|
6171
6185
|
|
6172
6186
|
function scheduleIt() {
|
6173
|
-
|
6187
|
+
scheduleOnce('actions', myContext, log);
|
6174
6188
|
}
|
6175
6189
|
|
6176
6190
|
scheduleIt();
|
@@ -6180,8 +6194,10 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
6180
6194
|
But this other case will schedule the function multiple times:
|
6181
6195
|
|
6182
6196
|
```javascript
|
6197
|
+
import { scheduleOnce } from '@ember/runloop';
|
6198
|
+
|
6183
6199
|
function scheduleIt() {
|
6184
|
-
|
6200
|
+
scheduleOnce('actions', myContext, function() {
|
6185
6201
|
console.log('Closure');
|
6186
6202
|
});
|
6187
6203
|
}
|
@@ -6220,7 +6236,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
6220
6236
|
`run.later` with a wait time of 1ms.
|
6221
6237
|
|
6222
6238
|
```javascript
|
6223
|
-
|
6239
|
+
import { next } from '@ember/runloop';
|
6240
|
+
|
6241
|
+
next(myContext, function() {
|
6224
6242
|
// code to be executed in the next run loop,
|
6225
6243
|
// which will be scheduled after the current one
|
6226
6244
|
});
|
@@ -6242,11 +6260,12 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
6242
6260
|
|
6243
6261
|
```app/components/my-component.js
|
6244
6262
|
import Component from '@ember/component';
|
6263
|
+
import { scheduleOnce } from '@ember/runloop';
|
6245
6264
|
|
6246
6265
|
export Component.extend({
|
6247
6266
|
didInsertElement() {
|
6248
6267
|
this._super(...arguments);
|
6249
|
-
|
6268
|
+
scheduleOnce('afterRender', this, 'processChildElements');
|
6250
6269
|
},
|
6251
6270
|
|
6252
6271
|
processChildElements() {
|
@@ -6291,53 +6310,63 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
6291
6310
|
};
|
6292
6311
|
|
6293
6312
|
/**
|
6294
|
-
Cancels a scheduled item. Must be a value returned by `
|
6295
|
-
`
|
6296
|
-
`
|
6313
|
+
Cancels a scheduled item. Must be a value returned by `later()`,
|
6314
|
+
`once()`, `scheduleOnce()`, `next()`, `debounce()`, or
|
6315
|
+
`throttle()`.
|
6297
6316
|
|
6298
6317
|
```javascript
|
6299
|
-
|
6318
|
+
import {
|
6319
|
+
next,
|
6320
|
+
cancel,
|
6321
|
+
later,
|
6322
|
+
scheduleOnce,
|
6323
|
+
once,
|
6324
|
+
throttle,
|
6325
|
+
debounce
|
6326
|
+
} from '@ember/runloop';
|
6327
|
+
|
6328
|
+
let runNext = next(myContext, function() {
|
6300
6329
|
// will not be executed
|
6301
6330
|
});
|
6302
6331
|
|
6303
|
-
|
6332
|
+
cancel(runNext);
|
6304
6333
|
|
6305
|
-
let runLater =
|
6334
|
+
let runLater = later(myContext, function() {
|
6306
6335
|
// will not be executed
|
6307
6336
|
}, 500);
|
6308
6337
|
|
6309
|
-
|
6338
|
+
cancel(runLater);
|
6310
6339
|
|
6311
|
-
let runScheduleOnce =
|
6340
|
+
let runScheduleOnce = scheduleOnce('afterRender', myContext, function() {
|
6312
6341
|
// will not be executed
|
6313
6342
|
});
|
6314
6343
|
|
6315
|
-
|
6344
|
+
cancel(runScheduleOnce);
|
6316
6345
|
|
6317
|
-
let runOnce =
|
6346
|
+
let runOnce = once(myContext, function() {
|
6318
6347
|
// will not be executed
|
6319
6348
|
});
|
6320
6349
|
|
6321
|
-
|
6350
|
+
cancel(runOnce);
|
6322
6351
|
|
6323
|
-
let throttle =
|
6352
|
+
let throttle = throttle(myContext, function() {
|
6324
6353
|
// will not be executed
|
6325
6354
|
}, 1, false);
|
6326
6355
|
|
6327
|
-
|
6356
|
+
cancel(throttle);
|
6328
6357
|
|
6329
|
-
let debounce =
|
6358
|
+
let debounce = debounce(myContext, function() {
|
6330
6359
|
// will not be executed
|
6331
6360
|
}, 1);
|
6332
6361
|
|
6333
|
-
|
6362
|
+
cancel(debounce);
|
6334
6363
|
|
6335
|
-
let debounceImmediate =
|
6364
|
+
let debounceImmediate = debounce(myContext, function() {
|
6336
6365
|
// will be executed since we passed in true (immediate)
|
6337
6366
|
}, 100, true);
|
6338
6367
|
|
6339
6368
|
// the 100ms delay until this method can be called again will be canceled
|
6340
|
-
|
6369
|
+
cancel(debounceImmediate);
|
6341
6370
|
```
|
6342
6371
|
|
6343
6372
|
@method cancel
|
@@ -6363,16 +6392,18 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
6363
6392
|
happen once scrolling has ceased.
|
6364
6393
|
|
6365
6394
|
```javascript
|
6395
|
+
import { debounce } from '@ember/runloop';
|
6396
|
+
|
6366
6397
|
function whoRan() {
|
6367
6398
|
console.log(this.name + ' ran.');
|
6368
6399
|
}
|
6369
6400
|
|
6370
6401
|
let myContext = { name: 'debounce' };
|
6371
6402
|
|
6372
|
-
|
6403
|
+
debounce(myContext, whoRan, 150);
|
6373
6404
|
|
6374
6405
|
// less than 150ms passes
|
6375
|
-
|
6406
|
+
debounce(myContext, whoRan, 150);
|
6376
6407
|
|
6377
6408
|
// 150ms passes
|
6378
6409
|
// whoRan is invoked with context myContext
|
@@ -6386,26 +6417,27 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
6386
6417
|
the method can be called again.
|
6387
6418
|
|
6388
6419
|
```javascript
|
6420
|
+
import { debounce } from '@ember/runloop';
|
6421
|
+
|
6389
6422
|
function whoRan() {
|
6390
6423
|
console.log(this.name + ' ran.');
|
6391
6424
|
}
|
6392
6425
|
|
6393
6426
|
let myContext = { name: 'debounce' };
|
6394
6427
|
|
6395
|
-
|
6428
|
+
debounce(myContext, whoRan, 150, true);
|
6396
6429
|
|
6397
6430
|
// console logs 'debounce ran.' one time immediately.
|
6398
6431
|
// 100ms passes
|
6399
|
-
|
6432
|
+
debounce(myContext, whoRan, 150, true);
|
6400
6433
|
|
6401
6434
|
// 150ms passes and nothing else is logged to the console and
|
6402
6435
|
// the debouncee is no longer being watched
|
6403
|
-
|
6436
|
+
debounce(myContext, whoRan, 150, true);
|
6404
6437
|
|
6405
6438
|
// console logs 'debounce ran.' one time immediately.
|
6406
6439
|
// 150ms passes and nothing else is logged to the console and
|
6407
6440
|
// the debouncee is no longer being watched
|
6408
|
-
|
6409
6441
|
```
|
6410
6442
|
|
6411
6443
|
@method debounce
|
@@ -6431,24 +6463,26 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
6431
6463
|
the specified spacing period. The target method is called immediately.
|
6432
6464
|
|
6433
6465
|
```javascript
|
6466
|
+
import { throttle } from '@ember/runloop';
|
6467
|
+
|
6434
6468
|
function whoRan() {
|
6435
6469
|
console.log(this.name + ' ran.');
|
6436
6470
|
}
|
6437
6471
|
|
6438
6472
|
let myContext = { name: 'throttle' };
|
6439
6473
|
|
6440
|
-
|
6474
|
+
throttle(myContext, whoRan, 150);
|
6441
6475
|
// whoRan is invoked with context myContext
|
6442
6476
|
// console logs 'throttle ran.'
|
6443
6477
|
|
6444
6478
|
// 50ms passes
|
6445
|
-
|
6479
|
+
throttle(myContext, whoRan, 150);
|
6446
6480
|
|
6447
6481
|
// 50ms passes
|
6448
|
-
|
6482
|
+
throttle(myContext, whoRan, 150);
|
6449
6483
|
|
6450
6484
|
// 150ms passes
|
6451
|
-
|
6485
|
+
throttle(myContext, whoRan, 150);
|
6452
6486
|
// whoRan is invoked with context myContext
|
6453
6487
|
// console logs 'throttle ran.'
|
6454
6488
|
```
|
@@ -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.18.0-beta.
|
9
|
+
* @version 2.18.0-beta.4
|
10
10
|
*/
|
11
11
|
|
12
12
|
/*global process */
|
@@ -9336,7 +9336,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
9336
9336
|
|
9337
9337
|
if (counter === 1) {
|
9338
9338
|
m.writeWatching(keyPath, 0);
|
9339
|
-
m.
|
9339
|
+
m.writableChains(makeChainNode).remove(keyPath);
|
9340
9340
|
} else if (counter > 1) {
|
9341
9341
|
m.writeWatching(keyPath, counter - 1);
|
9342
9342
|
}
|
@@ -9581,11 +9581,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
9581
9581
|
if (paths === undefined) {
|
9582
9582
|
return;
|
9583
9583
|
}
|
9584
|
-
|
9585
9584
|
if (paths[path] > 0) {
|
9586
9585
|
paths[path]--;
|
9587
|
-
} else {
|
9588
|
-
return;
|
9589
9586
|
}
|
9590
9587
|
|
9591
9588
|
var key = firstKey(path);
|
@@ -11947,14 +11944,15 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
11947
11944
|
call.
|
11948
11945
|
|
11949
11946
|
```javascript
|
11947
|
+
import { run } from '@ember/runloop';
|
11948
|
+
|
11950
11949
|
run(function() {
|
11951
11950
|
// code to be executed within a RunLoop
|
11952
11951
|
});
|
11953
11952
|
```
|
11954
|
-
|
11955
|
-
@
|
11953
|
+
@method run
|
11954
|
+
@for @ember/runloop
|
11956
11955
|
@static
|
11957
|
-
@constructor
|
11958
11956
|
@param {Object} [target] target of method to call
|
11959
11957
|
@param {Function|String} method Method to invoke.
|
11960
11958
|
May be a function or a string. If you pass a string
|
@@ -11977,7 +11975,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
11977
11975
|
If invoked when not within a run loop:
|
11978
11976
|
|
11979
11977
|
```javascript
|
11980
|
-
|
11978
|
+
import { join } from '@ember/runloop';
|
11979
|
+
|
11980
|
+
join(function() {
|
11981
11981
|
// creates a new run-loop
|
11982
11982
|
});
|
11983
11983
|
```
|
@@ -11985,9 +11985,12 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
11985
11985
|
Alternatively, if called within an existing run loop:
|
11986
11986
|
|
11987
11987
|
```javascript
|
11988
|
+
import { run, join } from '@ember/runloop';
|
11989
|
+
|
11988
11990
|
run(function() {
|
11989
11991
|
// creates a new run-loop
|
11990
|
-
|
11992
|
+
|
11993
|
+
join(function() {
|
11991
11994
|
// joins with the existing run-loop, and queues for invocation on
|
11992
11995
|
// the existing run-loops action queue.
|
11993
11996
|
});
|
@@ -12016,7 +12019,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
12016
12019
|
makes this method a great way to asynchronously integrate third-party libraries
|
12017
12020
|
into your Ember application.
|
12018
12021
|
|
12019
|
-
`
|
12022
|
+
`bind` takes two main arguments, the desired context and the function to
|
12020
12023
|
invoke in that context. Any additional arguments will be supplied as arguments
|
12021
12024
|
to the function that is passed in.
|
12022
12025
|
|
@@ -12028,10 +12031,11 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
12028
12031
|
|
12029
12032
|
```app/components/rich-text-editor.js
|
12030
12033
|
import Component from '@ember/component';
|
12034
|
+
import { on } from '@ember/object/evented';
|
12031
12035
|
import { bind } from '@ember/runloop';
|
12032
12036
|
|
12033
12037
|
export default Component.extend({
|
12034
|
-
initializeTinyMCE:
|
12038
|
+
initializeTinyMCE: on('didInsertElement', function() {
|
12035
12039
|
tinymce.init({
|
12036
12040
|
selector: '#' + this.$().prop('id'),
|
12037
12041
|
setup: Ember.run.bind(this, this.setupEditor)
|
@@ -12099,9 +12103,11 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
12099
12103
|
a lower-level way to use a RunLoop instead of using `run()`.
|
12100
12104
|
|
12101
12105
|
```javascript
|
12102
|
-
|
12106
|
+
import { begin, end } from '@ember/runloop';
|
12107
|
+
|
12108
|
+
begin();
|
12103
12109
|
// code to be executed within a RunLoop
|
12104
|
-
|
12110
|
+
end();
|
12105
12111
|
```
|
12106
12112
|
|
12107
12113
|
@method begin
|
@@ -12120,9 +12126,11 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
12120
12126
|
to use a RunLoop instead of using `run()`.
|
12121
12127
|
|
12122
12128
|
```javascript
|
12123
|
-
|
12129
|
+
import { begin, end } from '@ember/runloop';
|
12130
|
+
|
12131
|
+
begin();
|
12124
12132
|
// code to be executed within a RunLoop
|
12125
|
-
|
12133
|
+
end();
|
12126
12134
|
```
|
12127
12135
|
|
12128
12136
|
@method end
|
@@ -12158,12 +12166,14 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
12158
12166
|
the `run.queues` property.
|
12159
12167
|
|
12160
12168
|
```javascript
|
12161
|
-
|
12169
|
+
import { schedule } from '@ember/runloop';
|
12170
|
+
|
12171
|
+
schedule('sync', this, function() {
|
12162
12172
|
// this will be executed in the first RunLoop queue, when bindings are synced
|
12163
12173
|
console.log('scheduled on sync queue');
|
12164
12174
|
});
|
12165
12175
|
|
12166
|
-
|
12176
|
+
schedule('actions', this, function() {
|
12167
12177
|
// this will be executed in the 'actions' queue, after bindings have synced.
|
12168
12178
|
console.log('scheduled on actions queue');
|
12169
12179
|
});
|
@@ -12239,7 +12249,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
12239
12249
|
together, which is often more efficient than using a real setTimeout.
|
12240
12250
|
|
12241
12251
|
```javascript
|
12242
|
-
|
12252
|
+
import { later } from '@ember/runloop';
|
12253
|
+
|
12254
|
+
later(myContext, function() {
|
12243
12255
|
// code here will execute within a RunLoop in about 500ms with this == myContext
|
12244
12256
|
}, 500);
|
12245
12257
|
```
|
@@ -12298,13 +12310,15 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
12298
12310
|
calls.
|
12299
12311
|
|
12300
12312
|
```javascript
|
12313
|
+
import { run, scheduleOnce } from '@ember/runloop';
|
12314
|
+
|
12301
12315
|
function sayHi() {
|
12302
12316
|
console.log('hi');
|
12303
12317
|
}
|
12304
12318
|
|
12305
12319
|
run(function() {
|
12306
|
-
|
12307
|
-
|
12320
|
+
scheduleOnce('afterRender', myContext, sayHi);
|
12321
|
+
scheduleOnce('afterRender', myContext, sayHi);
|
12308
12322
|
// sayHi will only be executed once, in the afterRender queue of the RunLoop
|
12309
12323
|
});
|
12310
12324
|
```
|
@@ -12318,7 +12332,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
12318
12332
|
}
|
12319
12333
|
|
12320
12334
|
function scheduleIt() {
|
12321
|
-
|
12335
|
+
scheduleOnce('actions', myContext, log);
|
12322
12336
|
}
|
12323
12337
|
|
12324
12338
|
scheduleIt();
|
@@ -12328,8 +12342,10 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
12328
12342
|
But this other case will schedule the function multiple times:
|
12329
12343
|
|
12330
12344
|
```javascript
|
12345
|
+
import { scheduleOnce } from '@ember/runloop';
|
12346
|
+
|
12331
12347
|
function scheduleIt() {
|
12332
|
-
|
12348
|
+
scheduleOnce('actions', myContext, function() {
|
12333
12349
|
console.log('Closure');
|
12334
12350
|
});
|
12335
12351
|
}
|
@@ -12368,7 +12384,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
12368
12384
|
`run.later` with a wait time of 1ms.
|
12369
12385
|
|
12370
12386
|
```javascript
|
12371
|
-
|
12387
|
+
import { next } from '@ember/runloop';
|
12388
|
+
|
12389
|
+
next(myContext, function() {
|
12372
12390
|
// code to be executed in the next run loop,
|
12373
12391
|
// which will be scheduled after the current one
|
12374
12392
|
});
|
@@ -12390,11 +12408,12 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
12390
12408
|
|
12391
12409
|
```app/components/my-component.js
|
12392
12410
|
import Component from '@ember/component';
|
12411
|
+
import { scheduleOnce } from '@ember/runloop';
|
12393
12412
|
|
12394
12413
|
export Component.extend({
|
12395
12414
|
didInsertElement() {
|
12396
12415
|
this._super(...arguments);
|
12397
|
-
|
12416
|
+
scheduleOnce('afterRender', this, 'processChildElements');
|
12398
12417
|
},
|
12399
12418
|
|
12400
12419
|
processChildElements() {
|
@@ -12441,53 +12460,63 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
12441
12460
|
};
|
12442
12461
|
|
12443
12462
|
/**
|
12444
|
-
Cancels a scheduled item. Must be a value returned by `
|
12445
|
-
`
|
12446
|
-
`
|
12463
|
+
Cancels a scheduled item. Must be a value returned by `later()`,
|
12464
|
+
`once()`, `scheduleOnce()`, `next()`, `debounce()`, or
|
12465
|
+
`throttle()`.
|
12447
12466
|
|
12448
12467
|
```javascript
|
12449
|
-
|
12468
|
+
import {
|
12469
|
+
next,
|
12470
|
+
cancel,
|
12471
|
+
later,
|
12472
|
+
scheduleOnce,
|
12473
|
+
once,
|
12474
|
+
throttle,
|
12475
|
+
debounce
|
12476
|
+
} from '@ember/runloop';
|
12477
|
+
|
12478
|
+
let runNext = next(myContext, function() {
|
12450
12479
|
// will not be executed
|
12451
12480
|
});
|
12452
12481
|
|
12453
|
-
|
12482
|
+
cancel(runNext);
|
12454
12483
|
|
12455
|
-
let runLater =
|
12484
|
+
let runLater = later(myContext, function() {
|
12456
12485
|
// will not be executed
|
12457
12486
|
}, 500);
|
12458
12487
|
|
12459
|
-
|
12488
|
+
cancel(runLater);
|
12460
12489
|
|
12461
|
-
let runScheduleOnce =
|
12490
|
+
let runScheduleOnce = scheduleOnce('afterRender', myContext, function() {
|
12462
12491
|
// will not be executed
|
12463
12492
|
});
|
12464
12493
|
|
12465
|
-
|
12494
|
+
cancel(runScheduleOnce);
|
12466
12495
|
|
12467
|
-
let runOnce =
|
12496
|
+
let runOnce = once(myContext, function() {
|
12468
12497
|
// will not be executed
|
12469
12498
|
});
|
12470
12499
|
|
12471
|
-
|
12500
|
+
cancel(runOnce);
|
12472
12501
|
|
12473
|
-
let throttle =
|
12502
|
+
let throttle = throttle(myContext, function() {
|
12474
12503
|
// will not be executed
|
12475
12504
|
}, 1, false);
|
12476
12505
|
|
12477
|
-
|
12506
|
+
cancel(throttle);
|
12478
12507
|
|
12479
|
-
let debounce =
|
12508
|
+
let debounce = debounce(myContext, function() {
|
12480
12509
|
// will not be executed
|
12481
12510
|
}, 1);
|
12482
12511
|
|
12483
|
-
|
12512
|
+
cancel(debounce);
|
12484
12513
|
|
12485
|
-
let debounceImmediate =
|
12514
|
+
let debounceImmediate = debounce(myContext, function() {
|
12486
12515
|
// will be executed since we passed in true (immediate)
|
12487
12516
|
}, 100, true);
|
12488
12517
|
|
12489
12518
|
// the 100ms delay until this method can be called again will be canceled
|
12490
|
-
|
12519
|
+
cancel(debounceImmediate);
|
12491
12520
|
```
|
12492
12521
|
|
12493
12522
|
@method cancel
|
@@ -12513,16 +12542,18 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
12513
12542
|
happen once scrolling has ceased.
|
12514
12543
|
|
12515
12544
|
```javascript
|
12545
|
+
import { debounce } from '@ember/runloop';
|
12546
|
+
|
12516
12547
|
function whoRan() {
|
12517
12548
|
console.log(this.name + ' ran.');
|
12518
12549
|
}
|
12519
12550
|
|
12520
12551
|
let myContext = { name: 'debounce' };
|
12521
12552
|
|
12522
|
-
|
12553
|
+
debounce(myContext, whoRan, 150);
|
12523
12554
|
|
12524
12555
|
// less than 150ms passes
|
12525
|
-
|
12556
|
+
debounce(myContext, whoRan, 150);
|
12526
12557
|
|
12527
12558
|
// 150ms passes
|
12528
12559
|
// whoRan is invoked with context myContext
|
@@ -12536,26 +12567,27 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
12536
12567
|
the method can be called again.
|
12537
12568
|
|
12538
12569
|
```javascript
|
12570
|
+
import { debounce } from '@ember/runloop';
|
12571
|
+
|
12539
12572
|
function whoRan() {
|
12540
12573
|
console.log(this.name + ' ran.');
|
12541
12574
|
}
|
12542
12575
|
|
12543
12576
|
let myContext = { name: 'debounce' };
|
12544
12577
|
|
12545
|
-
|
12578
|
+
debounce(myContext, whoRan, 150, true);
|
12546
12579
|
|
12547
12580
|
// console logs 'debounce ran.' one time immediately.
|
12548
12581
|
// 100ms passes
|
12549
|
-
|
12582
|
+
debounce(myContext, whoRan, 150, true);
|
12550
12583
|
|
12551
12584
|
// 150ms passes and nothing else is logged to the console and
|
12552
12585
|
// the debouncee is no longer being watched
|
12553
|
-
|
12586
|
+
debounce(myContext, whoRan, 150, true);
|
12554
12587
|
|
12555
12588
|
// console logs 'debounce ran.' one time immediately.
|
12556
12589
|
// 150ms passes and nothing else is logged to the console and
|
12557
12590
|
// the debouncee is no longer being watched
|
12558
|
-
|
12559
12591
|
```
|
12560
12592
|
|
12561
12593
|
@method debounce
|
@@ -12581,24 +12613,26 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
12581
12613
|
the specified spacing period. The target method is called immediately.
|
12582
12614
|
|
12583
12615
|
```javascript
|
12616
|
+
import { throttle } from '@ember/runloop';
|
12617
|
+
|
12584
12618
|
function whoRan() {
|
12585
12619
|
console.log(this.name + ' ran.');
|
12586
12620
|
}
|
12587
12621
|
|
12588
12622
|
let myContext = { name: 'throttle' };
|
12589
12623
|
|
12590
|
-
|
12624
|
+
throttle(myContext, whoRan, 150);
|
12591
12625
|
// whoRan is invoked with context myContext
|
12592
12626
|
// console logs 'throttle ran.'
|
12593
12627
|
|
12594
12628
|
// 50ms passes
|
12595
|
-
|
12629
|
+
throttle(myContext, whoRan, 150);
|
12596
12630
|
|
12597
12631
|
// 50ms passes
|
12598
|
-
|
12632
|
+
throttle(myContext, whoRan, 150);
|
12599
12633
|
|
12600
12634
|
// 150ms passes
|
12601
|
-
|
12635
|
+
throttle(myContext, whoRan, 150);
|
12602
12636
|
// whoRan is invoked with context myContext
|
12603
12637
|
// console logs 'throttle ran.'
|
12604
12638
|
```
|
@@ -17312,7 +17346,7 @@ enifed('ember/features', ['exports', 'ember-environment', 'ember-utils'], functi
|
|
17312
17346
|
enifed("ember/version", ["exports"], function (exports) {
|
17313
17347
|
"use strict";
|
17314
17348
|
|
17315
|
-
exports.default = "2.18.0-beta.
|
17349
|
+
exports.default = "2.18.0-beta.4";
|
17316
17350
|
});
|
17317
17351
|
enifed("handlebars", ["exports"], function (exports) {
|
17318
17352
|
"use strict";
|