ember-source 4.3.0-beta.1 → 4.4.0-alpha.3
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.
- package/blueprints/acceptance-test/mocha-files/tests/acceptance/__name__-test.js +4 -4
- package/blueprints/acceptance-test/mocha-rfc-232-files/tests/acceptance/__name__-test.js +2 -2
- package/blueprints/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +2 -2
- package/blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +2 -2
- package/blueprints/component/index.js +2 -2
- package/blueprints/component-class/index.js +2 -2
- package/blueprints/component-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +4 -4
- package/blueprints/component-test/mocha-files/__root__/__testType__/__path__/__test__.js +7 -5
- package/blueprints/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +4 -4
- package/blueprints/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +4 -4
- package/blueprints/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +4 -4
- package/blueprints/controller/files/__root__/__path__/__name__.js +1 -2
- package/blueprints/controller-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/controller-test/mocha-files/__root__/__testType__/__path__/__test__.js +5 -3
- package/blueprints/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/controller-test/qunit-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/helper/files/__root__/__collection__/__name__.js +1 -1
- package/blueprints/helper/mu-files/__root__/__collection__/__name__.js +1 -1
- package/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +3 -3
- package/blueprints/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +6 -4
- package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -2
- package/blueprints/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +2 -2
- package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -2
- package/blueprints/initializer/files/__root__/initializers/__name__.js +2 -3
- package/blueprints/initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +6 -7
- package/blueprints/initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +5 -5
- package/blueprints/initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +3 -4
- package/blueprints/instance-initializer/files/__root__/instance-initializers/__name__.js +2 -3
- package/blueprints/instance-initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +5 -5
- package/blueprints/instance-initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +5 -5
- package/blueprints/instance-initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +2 -2
- package/blueprints/mixin/files/__root__/mixins/__name__.js +1 -2
- package/blueprints/mixin-test/mocha-files/__root__/__testType__/__name__-test.js +2 -2
- package/blueprints/mixin-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +2 -2
- package/blueprints/mixin-test/qunit-files/__root__/__testType__/__name__-test.js +1 -1
- package/blueprints/mixin-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +1 -1
- package/blueprints/route/files/__root__/__path__/__name__.js +2 -2
- package/blueprints/route-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/route-test/mocha-files/__root__/__testType__/__path__/__test__.js +5 -3
- package/blueprints/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/route-test/qunit-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/service/files/__root__/__path__/__name__.js +1 -2
- package/blueprints/service-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/service-test/mocha-files/__root__/__testType__/__path__/__test__.js +5 -3
- package/blueprints/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/service-test/qunit-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/util-test/mocha-files/__root__/__testType__/__name__-test.js +2 -2
- package/blueprints/util-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +2 -2
- package/blueprints/util-test/qunit-files/__root__/__testType__/__name__-test.js +1 -1
- package/blueprints/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +2 -3
- package/build-metadata.json +3 -3
- package/dist/dependencies/router_js.js +1 -1
- package/dist/ember-template-compiler.js +17 -144
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +4 -2
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +843 -772
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/container/index.js +3 -3
- package/dist/packages/@ember/-internals/glimmer/index.js +55 -29
- package/dist/packages/@ember/-internals/metal/index.js +18 -28
- package/dist/packages/@ember/-internals/routing/lib/location/hash_location.js +1 -1
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +67 -12
- package/dist/packages/@ember/-internals/routing/lib/services/routing.js +2 -0
- package/dist/packages/@ember/-internals/routing/lib/system/generate_controller.js +3 -1
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +16 -9
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +15 -20
- package/dist/packages/@ember/-internals/routing/lib/utils.js +2 -1
- package/dist/packages/@ember/-internals/runtime/lib/compare.js +19 -5
- package/dist/packages/@ember/-internals/runtime/lib/mixins/comparable.js +4 -4
- package/dist/packages/@ember/-internals/runtime/lib/mixins/container_proxy.js +29 -29
- package/dist/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +51 -50
- package/dist/packages/@ember/-internals/utils/index.js +1 -1
- package/dist/packages/@ember/application/instance.js +3 -3
- package/dist/packages/@ember/canary-features/index.js +6 -14
- package/dist/packages/@ember/debug/lib/capture-render-tree.js +2 -0
- package/dist/packages/@ember/debug/lib/handlers.js +1 -1
- package/dist/packages/@ember/runloop/index.js +31 -528
- package/dist/packages/@ember/runloop/type-tests.ts/begin-end.test.js +5 -0
- package/dist/packages/@ember/runloop/type-tests.ts/bind.test.js +59 -0
- package/dist/packages/@ember/runloop/type-tests.ts/cancel.test.js +5 -0
- package/dist/packages/@ember/runloop/type-tests.ts/debounce.test.js +77 -0
- package/dist/packages/@ember/runloop/type-tests.ts/join.test.js +38 -0
- package/dist/packages/@ember/runloop/type-tests.ts/later.test.js +38 -0
- package/dist/packages/@ember/runloop/type-tests.ts/next.test.js +38 -0
- package/dist/packages/@ember/runloop/type-tests.ts/once.test.js +38 -0
- package/dist/packages/@ember/runloop/type-tests.ts/run.test.js +38 -0
- package/dist/packages/@ember/runloop/type-tests.ts/schedule-once.test.js +39 -0
- package/dist/packages/@ember/runloop/type-tests.ts/schedule.test.js +39 -0
- package/dist/packages/@ember/runloop/type-tests.ts/throttle.test.js +77 -0
- package/dist/packages/ember/index.js +4 -14
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +330 -245
- package/package.json +4 -4
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { debounce } from '@ember/runloop';
|
|
2
|
+
import { expectTypeOf } from 'expect-type'; // From Docs
|
|
3
|
+
|
|
4
|
+
function whoRan() {// Do stuff
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
let myContext = {
|
|
8
|
+
name: 'debounce',
|
|
9
|
+
|
|
10
|
+
test(_foo, _baz) {}
|
|
11
|
+
|
|
12
|
+
};
|
|
13
|
+
debounce(myContext, whoRan, 150); // less than 150ms passes
|
|
14
|
+
|
|
15
|
+
debounce(myContext, whoRan, 150);
|
|
16
|
+
debounce(myContext, whoRan, 150, true); // console logs 'debounce ran.' one time immediately.
|
|
17
|
+
// 100ms passes
|
|
18
|
+
|
|
19
|
+
debounce(myContext, whoRan, 150, true); // 150ms passes and nothing else is logged to the console and
|
|
20
|
+
// the debouncee is no longer being watched
|
|
21
|
+
|
|
22
|
+
debounce(myContext, whoRan, 150, true); // console logs 'debounce ran.' one time immediately.
|
|
23
|
+
// 150ms passes and nothing else is logged to the console and
|
|
24
|
+
// the debouncee is no longer being watched
|
|
25
|
+
// Method only
|
|
26
|
+
|
|
27
|
+
expectTypeOf(debounce((_foo, _baz) => {}, 1, undefined, 1)).toEqualTypeOf(); // @ts-expect-error Requires wait
|
|
28
|
+
|
|
29
|
+
debounce((_foo, _baz) => {}, 1, true); // @ts-expect-error Requires all args
|
|
30
|
+
|
|
31
|
+
debounce((_foo, _baz) => {}, 1, 1); // Can set immediate
|
|
32
|
+
|
|
33
|
+
debounce((_foo, _baz) => {}, 1, true, 1, true); // With target
|
|
34
|
+
|
|
35
|
+
debounce(myContext, function (_foo, _baz) {
|
|
36
|
+
expectTypeOf(this).toEqualTypeOf(myContext);
|
|
37
|
+
}, 1, true, 1, true); // With key
|
|
38
|
+
|
|
39
|
+
debounce(myContext, 'test', 1, true, 1, true); // @ts-expect-error invalid key
|
|
40
|
+
|
|
41
|
+
debounce(myContext, 'invalid');
|
|
42
|
+
|
|
43
|
+
class Foo {
|
|
44
|
+
test(_foo, _bar, _baz) {
|
|
45
|
+
return 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let foo = new Foo(); // With only function
|
|
51
|
+
|
|
52
|
+
expectTypeOf(debounce((_foo, _bar, _baz) => {
|
|
53
|
+
return 1;
|
|
54
|
+
}, 1, true, undefined, 1)).toEqualTypeOf();
|
|
55
|
+
expectTypeOf(debounce((_foo, _bar, _baz) => {
|
|
56
|
+
return 1;
|
|
57
|
+
}, 1, true, 'string', 1)).toEqualTypeOf();
|
|
58
|
+
debounce(_foo => {
|
|
59
|
+
return 1; // @ts-expect-error invalid argument
|
|
60
|
+
}, 'string'); // With target and function
|
|
61
|
+
|
|
62
|
+
expectTypeOf(debounce(foo, function (_foo, _bar, _baz) {
|
|
63
|
+
expectTypeOf(this).toEqualTypeOf();
|
|
64
|
+
return 1;
|
|
65
|
+
}, 1, true, undefined, 1)).toEqualTypeOf();
|
|
66
|
+
expectTypeOf(debounce(foo, function (_foo, _bar, _baz) {
|
|
67
|
+
return 1;
|
|
68
|
+
}, 1, true, 'string', 1)).toEqualTypeOf(); // @ts-expect-error invalid args
|
|
69
|
+
|
|
70
|
+
debounce(foo, function (_foo, _bar, _baz) {
|
|
71
|
+
return 1;
|
|
72
|
+
}, 1, 'string', true, 1); // With function string reference
|
|
73
|
+
|
|
74
|
+
expectTypeOf(debounce(foo, 'test', 1, true, 'string', 1)).toEqualTypeOf();
|
|
75
|
+
expectTypeOf(debounce(foo, 'test', 1, true, undefined, 1)).toEqualTypeOf(); // @ts-expect-error Invalid args
|
|
76
|
+
|
|
77
|
+
debounce(foo, 'test', 'string');
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { join } from '@ember/runloop';
|
|
2
|
+
import { expectTypeOf } from 'expect-type';
|
|
3
|
+
|
|
4
|
+
class Foo {
|
|
5
|
+
test(_foo, _bar, _baz) {
|
|
6
|
+
return 1;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let foo = new Foo(); // With only function
|
|
12
|
+
|
|
13
|
+
expectTypeOf(join((_foo, _bar, _baz) => {
|
|
14
|
+
return 1;
|
|
15
|
+
}, 1, true)).toEqualTypeOf();
|
|
16
|
+
expectTypeOf(join((_foo, _bar, _baz) => {
|
|
17
|
+
return 1;
|
|
18
|
+
}, 1, true, 'string')).toEqualTypeOf();
|
|
19
|
+
join(_foo => {
|
|
20
|
+
return 1; // @ts-expect-error invalid argument
|
|
21
|
+
}, 'string'); // With target and function
|
|
22
|
+
|
|
23
|
+
expectTypeOf(join(foo, function (_foo, _bar, _baz) {
|
|
24
|
+
expectTypeOf(this).toEqualTypeOf();
|
|
25
|
+
return 1;
|
|
26
|
+
}, 1, true)).toEqualTypeOf();
|
|
27
|
+
expectTypeOf(join(foo, function (_foo, _bar, _baz) {
|
|
28
|
+
return 1;
|
|
29
|
+
}, 1, true, 'string')).toEqualTypeOf(); // @ts-expect-error invalid args
|
|
30
|
+
|
|
31
|
+
join(foo, function (_foo, _bar, _baz) {
|
|
32
|
+
return 1;
|
|
33
|
+
}, 1, 'string'); // With function string reference
|
|
34
|
+
|
|
35
|
+
expectTypeOf(join(foo, 'test', 1, true)).toEqualTypeOf();
|
|
36
|
+
expectTypeOf(join(foo, 'test', 1, true, 'string')).toEqualTypeOf(); // @ts-expect-error Invalid args
|
|
37
|
+
|
|
38
|
+
join(foo, 'test', 'string');
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { later } from '@ember/runloop';
|
|
2
|
+
import { expectTypeOf } from 'expect-type';
|
|
3
|
+
|
|
4
|
+
class Foo {
|
|
5
|
+
test(_foo, _bar, _baz) {
|
|
6
|
+
return 1;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let foo = new Foo(); // With only function
|
|
12
|
+
|
|
13
|
+
expectTypeOf(later((_foo, _bar, _baz) => {
|
|
14
|
+
return 1;
|
|
15
|
+
}, 1, true, undefined, 1)).toEqualTypeOf();
|
|
16
|
+
expectTypeOf(later((_foo, _bar, _baz) => {
|
|
17
|
+
return 1;
|
|
18
|
+
}, 1, true, 'string', 1)).toEqualTypeOf();
|
|
19
|
+
later(_foo => {
|
|
20
|
+
return 1; // @ts-expect-error invalid argument
|
|
21
|
+
}, 'string'); // With target and function
|
|
22
|
+
|
|
23
|
+
expectTypeOf(later(foo, function (_foo, _bar, _baz) {
|
|
24
|
+
expectTypeOf(this).toEqualTypeOf();
|
|
25
|
+
return 1;
|
|
26
|
+
}, 1, true, undefined, 1)).toEqualTypeOf();
|
|
27
|
+
expectTypeOf(later(foo, function (_foo, _bar, _baz) {
|
|
28
|
+
return 1;
|
|
29
|
+
}, 1, true, 'string', 1)).toEqualTypeOf(); // @ts-expect-error invalid args
|
|
30
|
+
|
|
31
|
+
later(foo, function (_foo, _bar, _baz) {
|
|
32
|
+
return 1;
|
|
33
|
+
}, 1, 'string', true, 1); // With function string reference
|
|
34
|
+
|
|
35
|
+
expectTypeOf(later(foo, 'test', 1, true, 'string', 1)).toEqualTypeOf();
|
|
36
|
+
expectTypeOf(later(foo, 'test', 1, true, undefined, 1)).toEqualTypeOf(); // @ts-expect-error Invalid args
|
|
37
|
+
|
|
38
|
+
later(foo, 'test', 'string');
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { next } from '@ember/runloop';
|
|
2
|
+
import { expectTypeOf } from 'expect-type';
|
|
3
|
+
|
|
4
|
+
class Foo {
|
|
5
|
+
test(_foo, _bar, _baz) {
|
|
6
|
+
return 1;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let foo = new Foo(); // With only function
|
|
12
|
+
|
|
13
|
+
expectTypeOf(next((_foo, _bar, _baz) => {
|
|
14
|
+
return 1;
|
|
15
|
+
}, 1, true, undefined)).toEqualTypeOf();
|
|
16
|
+
expectTypeOf(next((_foo, _bar, _baz) => {
|
|
17
|
+
return 1;
|
|
18
|
+
}, 1, true, 'string')).toEqualTypeOf();
|
|
19
|
+
next(_foo => {
|
|
20
|
+
return 1; // @ts-expect-error invalid argument
|
|
21
|
+
}, 'string'); // With target and function
|
|
22
|
+
|
|
23
|
+
expectTypeOf(next(foo, function (_foo, _bar, _baz) {
|
|
24
|
+
expectTypeOf(this).toEqualTypeOf();
|
|
25
|
+
return 1;
|
|
26
|
+
}, 1, true)).toEqualTypeOf();
|
|
27
|
+
expectTypeOf(next(foo, function (_foo, _bar, _baz) {
|
|
28
|
+
return 1;
|
|
29
|
+
}, 1, true, 'string')).toEqualTypeOf(); // @ts-expect-error invalid args
|
|
30
|
+
|
|
31
|
+
next(foo, function (_foo, _bar, _baz) {
|
|
32
|
+
return 1;
|
|
33
|
+
}, 1, 'string', true); // With function string reference
|
|
34
|
+
|
|
35
|
+
expectTypeOf(next(foo, 'test', 1, true, 'string')).toEqualTypeOf();
|
|
36
|
+
expectTypeOf(next(foo, 'test', 1, true)).toEqualTypeOf(); // @ts-expect-error Invalid args
|
|
37
|
+
|
|
38
|
+
next(foo, 'test', 'string');
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { once } from '@ember/runloop';
|
|
2
|
+
import { expectTypeOf } from 'expect-type';
|
|
3
|
+
|
|
4
|
+
class Foo {
|
|
5
|
+
test(_foo, _bar, _baz) {
|
|
6
|
+
return 1;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let foo = new Foo(); // With only function
|
|
12
|
+
|
|
13
|
+
expectTypeOf(once((_foo, _bar, _baz) => {
|
|
14
|
+
return 1;
|
|
15
|
+
}, 1, true, undefined)).toEqualTypeOf();
|
|
16
|
+
expectTypeOf(once((_foo, _bar, _baz) => {
|
|
17
|
+
return 1;
|
|
18
|
+
}, 1, true, 'string')).toEqualTypeOf();
|
|
19
|
+
once(_foo => {
|
|
20
|
+
return 1; // @ts-expect-error invalid argument
|
|
21
|
+
}, 'string'); // With target and function
|
|
22
|
+
|
|
23
|
+
expectTypeOf(once(foo, function (_foo, _bar, _baz) {
|
|
24
|
+
expectTypeOf(this).toEqualTypeOf();
|
|
25
|
+
return 1;
|
|
26
|
+
}, 1, true)).toEqualTypeOf();
|
|
27
|
+
expectTypeOf(once(foo, function (_foo, _bar, _baz) {
|
|
28
|
+
return 1;
|
|
29
|
+
}, 1, true, 'string')).toEqualTypeOf(); // @ts-expect-error invalid args
|
|
30
|
+
|
|
31
|
+
once(foo, function (_foo, _bar, _baz) {
|
|
32
|
+
return 1;
|
|
33
|
+
}, 1, 'string', true); // With function string reference
|
|
34
|
+
|
|
35
|
+
expectTypeOf(once(foo, 'test', 1, true, 'string')).toEqualTypeOf();
|
|
36
|
+
expectTypeOf(once(foo, 'test', 1, true)).toEqualTypeOf(); // @ts-expect-error Invalid args
|
|
37
|
+
|
|
38
|
+
once(foo, 'test', 'string');
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { run } from '@ember/runloop';
|
|
2
|
+
import { expectTypeOf } from 'expect-type';
|
|
3
|
+
|
|
4
|
+
class Foo {
|
|
5
|
+
test(_foo, _bar, _baz) {
|
|
6
|
+
return 1;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let foo = new Foo(); // With only function
|
|
12
|
+
|
|
13
|
+
expectTypeOf(run((_foo, _bar, _baz) => {
|
|
14
|
+
return 1;
|
|
15
|
+
}, 1, true, undefined)).toEqualTypeOf();
|
|
16
|
+
expectTypeOf(run((_foo, _bar, _baz) => {
|
|
17
|
+
return 1;
|
|
18
|
+
}, 1, true, 'string')).toEqualTypeOf();
|
|
19
|
+
run(_foo => {
|
|
20
|
+
return 1; // @ts-expect-error invalid argument
|
|
21
|
+
}, 'string'); // With target and function
|
|
22
|
+
|
|
23
|
+
expectTypeOf(run(foo, function (_foo, _bar, _baz) {
|
|
24
|
+
expectTypeOf(this).toEqualTypeOf();
|
|
25
|
+
return 1;
|
|
26
|
+
}, 1, true)).toEqualTypeOf();
|
|
27
|
+
expectTypeOf(run(foo, function (_foo, _bar, _baz) {
|
|
28
|
+
return 1;
|
|
29
|
+
}, 1, true, 'string')).toEqualTypeOf(); // @ts-expect-error invalid args
|
|
30
|
+
|
|
31
|
+
run(foo, function (_foo, _bar, _baz) {
|
|
32
|
+
return 1;
|
|
33
|
+
}, 1, 'string', true); // With function string reference
|
|
34
|
+
|
|
35
|
+
expectTypeOf(run(foo, 'test', 1, true, 'string')).toEqualTypeOf();
|
|
36
|
+
expectTypeOf(run(foo, 'test', 1, true)).toEqualTypeOf(); // @ts-expect-error Invalid args
|
|
37
|
+
|
|
38
|
+
run(foo, 'test', 'string');
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { scheduleOnce } from '@ember/runloop';
|
|
2
|
+
import { expectTypeOf } from 'expect-type';
|
|
3
|
+
|
|
4
|
+
class Foo {
|
|
5
|
+
test(_foo, _bar, _baz) {
|
|
6
|
+
return 1;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let foo = new Foo(); // With only function
|
|
12
|
+
|
|
13
|
+
expectTypeOf(scheduleOnce('my-queue', (_foo, _bar, _baz) => {
|
|
14
|
+
return 1;
|
|
15
|
+
}, 1, true, undefined)).toEqualTypeOf();
|
|
16
|
+
expectTypeOf(scheduleOnce('my-queue', (_foo, _bar, _baz) => {
|
|
17
|
+
return 1;
|
|
18
|
+
}, 1, true, 'string')).toEqualTypeOf();
|
|
19
|
+
scheduleOnce('my-queue', _foo => {
|
|
20
|
+
return 1;
|
|
21
|
+
}, // @ts-expect-error invalid argument
|
|
22
|
+
'string'); // With target and function
|
|
23
|
+
|
|
24
|
+
expectTypeOf(scheduleOnce('my-queue', foo, function (_foo, _bar, _baz) {
|
|
25
|
+
expectTypeOf(this).toEqualTypeOf();
|
|
26
|
+
return 1;
|
|
27
|
+
}, 1, true)).toEqualTypeOf();
|
|
28
|
+
expectTypeOf(scheduleOnce('my-queue', foo, function (_foo, _bar, _baz) {
|
|
29
|
+
return 1;
|
|
30
|
+
}, 1, true, 'string')).toEqualTypeOf(); // @ts-expect-error invalid args
|
|
31
|
+
|
|
32
|
+
scheduleOnce('my-queue', foo, function (_foo, _bar, _baz) {
|
|
33
|
+
return 1;
|
|
34
|
+
}, 1, 'string', true); // With function string reference
|
|
35
|
+
|
|
36
|
+
expectTypeOf(scheduleOnce('my-queue', foo, 'test', 1, true, 'string')).toEqualTypeOf();
|
|
37
|
+
expectTypeOf(scheduleOnce('my-queue', foo, 'test', 1, true)).toEqualTypeOf(); // @ts-expect-error Invalid args
|
|
38
|
+
|
|
39
|
+
scheduleOnce('my-queue', foo, 'test', 'string');
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { schedule } from '@ember/runloop';
|
|
2
|
+
import { expectTypeOf } from 'expect-type';
|
|
3
|
+
|
|
4
|
+
class Foo {
|
|
5
|
+
test(_foo, _bar, _baz) {
|
|
6
|
+
return 1;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let foo = new Foo(); // With only function
|
|
12
|
+
|
|
13
|
+
expectTypeOf(schedule('my-queue', (_foo, _bar, _baz) => {
|
|
14
|
+
return 1;
|
|
15
|
+
}, 1, true, undefined)).toEqualTypeOf();
|
|
16
|
+
expectTypeOf(schedule('my-queue', (_foo, _bar, _baz) => {
|
|
17
|
+
return 1;
|
|
18
|
+
}, 1, true, 'string')).toEqualTypeOf();
|
|
19
|
+
schedule('my-queue', _foo => {
|
|
20
|
+
return 1;
|
|
21
|
+
}, // @ts-expect-error invalid argument
|
|
22
|
+
'string'); // With target and function
|
|
23
|
+
|
|
24
|
+
expectTypeOf(schedule('my-queue', foo, function (_foo, _bar, _baz) {
|
|
25
|
+
expectTypeOf(this).toEqualTypeOf();
|
|
26
|
+
return 1;
|
|
27
|
+
}, 1, true)).toEqualTypeOf();
|
|
28
|
+
expectTypeOf(schedule('my-queue', foo, function (_foo, _bar, _baz) {
|
|
29
|
+
return 1;
|
|
30
|
+
}, 1, true, 'string')).toEqualTypeOf(); // @ts-expect-error invalid args
|
|
31
|
+
|
|
32
|
+
schedule('my-queue', foo, function (_foo, _bar, _baz) {
|
|
33
|
+
return 1;
|
|
34
|
+
}, 1, 'string', true); // With function string reference
|
|
35
|
+
|
|
36
|
+
expectTypeOf(schedule('my-queue', foo, 'test', 1, true, 'string')).toEqualTypeOf();
|
|
37
|
+
expectTypeOf(schedule('my-queue', foo, 'test', 1, true)).toEqualTypeOf(); // @ts-expect-error Invalid args
|
|
38
|
+
|
|
39
|
+
schedule('my-queue', foo, 'test', 'string');
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { throttle } from '@ember/runloop';
|
|
2
|
+
import { expectTypeOf } from 'expect-type'; // From Docs
|
|
3
|
+
|
|
4
|
+
function whoRan() {// Do stuff
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
let myContext = {
|
|
8
|
+
name: 'throttle',
|
|
9
|
+
|
|
10
|
+
test(_foo, _baz) {}
|
|
11
|
+
|
|
12
|
+
};
|
|
13
|
+
throttle(myContext, whoRan, 150); // less than 150ms passes
|
|
14
|
+
|
|
15
|
+
throttle(myContext, whoRan, 150);
|
|
16
|
+
throttle(myContext, whoRan, 150, true); // console logs 'throttle ran.' one time immediately.
|
|
17
|
+
// 100ms passes
|
|
18
|
+
|
|
19
|
+
throttle(myContext, whoRan, 150, true); // 150ms passes and nothing else is logged to the console and
|
|
20
|
+
// the throttlee is no longer being watched
|
|
21
|
+
|
|
22
|
+
throttle(myContext, whoRan, 150, true); // console logs 'throttle ran.' one time immediately.
|
|
23
|
+
// 150ms passes and nothing else is logged to the console and
|
|
24
|
+
// the throttlee is no longer being watched
|
|
25
|
+
// Method only
|
|
26
|
+
|
|
27
|
+
expectTypeOf(throttle((_foo, _baz) => {}, 1, undefined, 1)).toEqualTypeOf(); // Wait is optional
|
|
28
|
+
|
|
29
|
+
throttle((_foo, _baz) => {}, 1, true); // @ts-expect-error Requires all args
|
|
30
|
+
|
|
31
|
+
throttle((_foo, _baz) => {}, 1, 1); // Can set immediate
|
|
32
|
+
|
|
33
|
+
throttle((_foo, _baz) => {}, 1, true, 1, true); // With target
|
|
34
|
+
|
|
35
|
+
throttle(myContext, function (_foo, _baz) {
|
|
36
|
+
expectTypeOf(this).toEqualTypeOf(myContext);
|
|
37
|
+
}, 1, true, 1, true); // With key
|
|
38
|
+
|
|
39
|
+
throttle(myContext, 'test', 1, true, 1, true); // @ts-expect-error invalid key
|
|
40
|
+
|
|
41
|
+
throttle(myContext, 'invalid');
|
|
42
|
+
|
|
43
|
+
class Foo {
|
|
44
|
+
test(_foo, _bar, _baz) {
|
|
45
|
+
return 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let foo = new Foo(); // With only function
|
|
51
|
+
|
|
52
|
+
expectTypeOf(throttle((_foo, _bar, _baz) => {
|
|
53
|
+
return 1;
|
|
54
|
+
}, 1, true, undefined, 1)).toEqualTypeOf();
|
|
55
|
+
expectTypeOf(throttle((_foo, _bar, _baz) => {
|
|
56
|
+
return 1;
|
|
57
|
+
}, 1, true, 'string', 1)).toEqualTypeOf();
|
|
58
|
+
throttle(_foo => {
|
|
59
|
+
return 1; // @ts-expect-error invalid argument
|
|
60
|
+
}, 'string'); // With target and function
|
|
61
|
+
|
|
62
|
+
expectTypeOf(throttle(foo, function (_foo, _bar, _baz) {
|
|
63
|
+
expectTypeOf(this).toEqualTypeOf();
|
|
64
|
+
return 1;
|
|
65
|
+
}, 1, true, undefined, 1)).toEqualTypeOf();
|
|
66
|
+
expectTypeOf(throttle(foo, function (_foo, _bar, _baz) {
|
|
67
|
+
return 1;
|
|
68
|
+
}, 1, true, 'string', 1)).toEqualTypeOf(); // @ts-expect-error invalid args
|
|
69
|
+
|
|
70
|
+
throttle(foo, function (_foo, _bar, _baz) {
|
|
71
|
+
return 1;
|
|
72
|
+
}, 1, 'string', true, 1); // With function string reference
|
|
73
|
+
|
|
74
|
+
expectTypeOf(throttle(foo, 'test', 1, true, 'string', 1)).toEqualTypeOf();
|
|
75
|
+
expectTypeOf(throttle(foo, 'test', 1, true, undefined, 1)).toEqualTypeOf(); // @ts-expect-error Invalid args
|
|
76
|
+
|
|
77
|
+
throttle(foo, 'test', 'string');
|
|
@@ -313,20 +313,9 @@ Ember._concat = concat;
|
|
|
313
313
|
Ember._get = get;
|
|
314
314
|
Ember._on = on;
|
|
315
315
|
Ember._fn = fn;
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
) {
|
|
320
|
-
Ember._helperManagerCapabilities = helperCapabilities;
|
|
321
|
-
Ember._setHelperManager = setHelperManager;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if (true
|
|
325
|
-
/* EMBER_GLIMMER_INVOKE_HELPER */
|
|
326
|
-
) {
|
|
327
|
-
Ember._invokeHelper = invokeHelper;
|
|
328
|
-
}
|
|
329
|
-
|
|
316
|
+
Ember._helperManagerCapabilities = helperCapabilities;
|
|
317
|
+
Ember._setHelperManager = setHelperManager;
|
|
318
|
+
Ember._invokeHelper = invokeHelper;
|
|
330
319
|
Ember._captureRenderTree = captureRenderTree;
|
|
331
320
|
|
|
332
321
|
const deprecateImportFromString = function (name, message = `Importing ${name} from '@ember/string' is deprecated. Please import ${name} from '@ember/template' instead.`) {
|
|
@@ -336,6 +325,7 @@ const deprecateImportFromString = function (name, message = `Importing ${name} f
|
|
|
336
325
|
id: 'ember-string.htmlsafe-ishtmlsafe',
|
|
337
326
|
for: 'ember-source',
|
|
338
327
|
since: {
|
|
328
|
+
available: '3.25',
|
|
339
329
|
enabled: '3.25'
|
|
340
330
|
},
|
|
341
331
|
until: '4.0.0',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default "4.
|
|
1
|
+
export default "4.4.0-alpha.3";
|