-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
application.ts
executable file
·44 lines (36 loc) · 1000 Bytes
/
application.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import Application from '@ember/application';
import ApplicationInstance from '@ember/application/instance';
import EmberObject from '@ember/object';
import { expectTypeOf } from 'expect-type';
const BaseApp = Application.extend({
modulePrefix: 'my-app',
});
class Obj extends EmberObject.extend({ foo: 'bar' }) {}
BaseApp.initializer({
name: 'my-initializer',
initialize(app) {
app.register('foo:bar', Obj);
},
});
BaseApp.instanceInitializer({
name: 'my-instance-initializer',
initialize(app) {
(app.lookup('foo:bar') as Obj).get('foo');
},
});
const App1 = BaseApp.create({
rootElement: '#app-one',
customEvents: {
paste: 'paste',
},
});
const App2 = BaseApp.create({
rootElement: '#app-two',
customEvents: {
mouseenter: null,
mouseleave: null,
},
});
const App3 = BaseApp.create();
expectTypeOf(App3.buildInstance()).toEqualTypeOf<ApplicationInstance>();
expectTypeOf(App3.buildInstance({ foo: 'bar' })).toEqualTypeOf<ApplicationInstance>();