ember-source 4.4.0-alpha.2 → 4.4.0-alpha.5
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/CHANGELOG.md +5 -1
- package/blueprints/acceptance-test/mocha-rfc-232-files/tests/acceptance/__name__-test.js +1 -1
- package/blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +1 -1
- package/blueprints/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +1 -1
- package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +1 -1
- package/blueprints/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +19 -8
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +9 -5
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +994 -1537
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/container/index.js +0 -16
- package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +10 -19
- package/dist/packages/@ember/-internals/extension-support/lib/data_adapter.js +113 -112
- package/dist/packages/@ember/-internals/glimmer/index.js +150 -749
- package/dist/packages/@ember/-internals/metal/index.js +6 -17
- package/dist/packages/@ember/-internals/routing/lib/location/hash_location.js +1 -1
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +65 -12
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +1 -1
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +11 -8
- package/dist/packages/@ember/-internals/runtime/lib/compare.js +19 -5
- package/dist/packages/@ember/-internals/runtime/lib/ext/rsvp.js +8 -4
- package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +1 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +1 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/comparable.js +4 -4
- package/dist/packages/@ember/-internals/runtime/lib/mixins/promise_proxy.js +16 -16
- package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +8 -8
- package/dist/packages/@ember/-internals/views/lib/system/utils.js +4 -2
- package/dist/packages/@ember/-internals/views/lib/views/core_view.js +5 -22
- package/dist/packages/@ember/canary-features/index.js +4 -2
- package/dist/packages/@ember/debug/index.js +1 -1
- package/dist/packages/@ember/debug/lib/deprecate.js +6 -2
- package/dist/packages/@ember/debug/lib/handlers.js +1 -1
- package/dist/packages/@ember/renderer/index.js +21 -0
- 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 +1 -0
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +591 -300
- package/package.json +11 -11
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { bind } 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(bind((_foo, _bar, _baz) => {
|
|
14
|
+
return 1;
|
|
15
|
+
})).toEqualTypeOf();
|
|
16
|
+
expectTypeOf(bind((_foo, _bar, _baz) => {
|
|
17
|
+
return 1;
|
|
18
|
+
}, 1)).toEqualTypeOf();
|
|
19
|
+
expectTypeOf(bind((_foo, _bar, _baz) => {
|
|
20
|
+
return 1;
|
|
21
|
+
}, 1, true)).toEqualTypeOf();
|
|
22
|
+
expectTypeOf(bind((_foo, _bar, _baz) => {
|
|
23
|
+
return 1;
|
|
24
|
+
}, 1, true, 'baz')).toEqualTypeOf();
|
|
25
|
+
expectTypeOf(bind((_foo, _bar, _baz) => {
|
|
26
|
+
return 1;
|
|
27
|
+
}, 1, true, undefined)).toEqualTypeOf();
|
|
28
|
+
bind(_foo => {
|
|
29
|
+
return 1; // @ts-expect-error invalid argument
|
|
30
|
+
}, 'string'); // With target and function
|
|
31
|
+
|
|
32
|
+
expectTypeOf(bind(foo, function (_foo, _bar, _baz) {
|
|
33
|
+
expectTypeOf(this).toEqualTypeOf();
|
|
34
|
+
return 1;
|
|
35
|
+
})).toEqualTypeOf();
|
|
36
|
+
expectTypeOf(bind(foo, function (_foo, _bar, _baz) {
|
|
37
|
+
return 1;
|
|
38
|
+
}, 1)).toEqualTypeOf();
|
|
39
|
+
expectTypeOf(bind(foo, function (_foo, _bar, _baz) {
|
|
40
|
+
return 1;
|
|
41
|
+
}, 1, true)).toEqualTypeOf();
|
|
42
|
+
expectTypeOf(bind(foo, function (_foo, _bar, _baz) {
|
|
43
|
+
return 1;
|
|
44
|
+
}, 1, true, 'baz')).toEqualTypeOf();
|
|
45
|
+
expectTypeOf(bind(foo, function (_foo, _bar, _baz) {
|
|
46
|
+
return 1;
|
|
47
|
+
}, 1, true, undefined)).toEqualTypeOf(); // @ts-expect-error Invalid args
|
|
48
|
+
|
|
49
|
+
bind(foo, function (_foo) {
|
|
50
|
+
return 1;
|
|
51
|
+
}, 'string'); // With function string reference
|
|
52
|
+
|
|
53
|
+
expectTypeOf(bind(foo, 'test')).toEqualTypeOf();
|
|
54
|
+
expectTypeOf(bind(foo, 'test', 1)).toEqualTypeOf();
|
|
55
|
+
expectTypeOf(bind(foo, 'test', 1, true)).toEqualTypeOf();
|
|
56
|
+
expectTypeOf(bind(foo, 'test', 1, true, 'baz')).toEqualTypeOf();
|
|
57
|
+
expectTypeOf(bind(foo, 'test', 1, true, undefined)).toEqualTypeOf(); // @ts-expect-error Invalid args
|
|
58
|
+
|
|
59
|
+
bind(foo, 'test', 'string');
|
|
@@ -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');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default "4.4.0-alpha.
|
|
1
|
+
export default "4.4.0-alpha.5";
|