1 | declare module '@ember/engine/instance' {
|
2 | /**
|
3 | @module @ember/engine
|
4 | */
|
5 | import EmberObject from '@ember/object';
|
6 | import { RSVP } from '@ember/-internals/runtime';
|
7 | import { Registry } from '@ember/-internals/container';
|
8 | import { ENGINE_PARENT } from '@ember/engine/parent';
|
9 | import { ContainerProxyMixin, RegistryProxyMixin } from '@ember/-internals/runtime';
|
10 | import type { InternalOwner } from '@ember/-internals/owner';
|
11 | import type Owner from '@ember/-internals/owner';
|
12 | import { type FullName } from '@ember/-internals/owner';
|
13 | import type Engine from '@ember/engine';
|
14 | import type Application from '@ember/application';
|
15 | import type { SimpleElement } from '@simple-dom/interface';
|
16 | export interface BootOptions {
|
17 | isBrowser?: boolean;
|
18 | shouldRender?: boolean;
|
19 | document?: Document | null;
|
20 | rootElement?: string | SimpleElement | null;
|
21 | location?: string | null;
|
22 | isInteractive?: boolean;
|
23 | _renderMode?: string;
|
24 | }
|
25 | export interface EngineInstanceOptions {
|
26 | mountPoint?: string;
|
27 | routable?: boolean;
|
28 | }
|
29 | /**
|
30 | The `EngineInstance` encapsulates all of the stateful aspects of a
|
31 | running `Engine`.
|
32 |
|
33 | @public
|
34 | @class EngineInstance
|
35 | @extends EmberObject
|
36 | @uses RegistryProxyMixin
|
37 | @uses ContainerProxyMixin
|
38 | */
|
39 | interface EngineInstance extends RegistryProxyMixin, ContainerProxyMixin, InternalOwner, Owner {}
|
40 | const EngineInstance_base: Readonly<typeof EmberObject> &
|
41 | (new (owner?: Owner | undefined) => EmberObject) &
|
42 | import('@ember/object/mixin').default;
|
43 | class EngineInstance extends EngineInstance_base {
|
44 | /**
|
45 | @private
|
46 | @method setupRegistry
|
47 | @param {Registry} registry
|
48 | @param {BootOptions} options
|
49 | */
|
50 | static setupRegistry(_registry: Registry, _options?: BootOptions): void;
|
51 | /**
|
52 | The base `Engine` for which this is an instance.
|
53 |
|
54 | @property {Engine} engine
|
55 | @private
|
56 | */
|
57 | base: Engine;
|
58 | application: Application;
|
59 | mountPoint?: string;
|
60 | routable?: boolean;
|
61 | [ENGINE_PARENT]?: EngineInstance;
|
62 | _booted: boolean;
|
63 | init(properties: object | undefined): void;
|
64 | _bootPromise: RSVP.Promise<this> | null;
|
65 | /**
|
66 | Initialize the `EngineInstance` and return a promise that resolves
|
67 | with the instance itself when the boot process is complete.
|
68 |
|
69 | The primary task here is to run any registered instance initializers.
|
70 |
|
71 | See the documentation on `BootOptions` for the options it takes.
|
72 |
|
73 | @public
|
74 | @method boot
|
75 | @param options {Object}
|
76 | @return {Promise<EngineInstance,Error>}
|
77 | */
|
78 | boot(options?: BootOptions): Promise<this>;
|
79 | /**
|
80 | Unfortunately, a lot of existing code assumes booting an instance is
|
81 | synchronous – specifically, a lot of tests assume the last call to
|
82 | `app.advanceReadiness()` or `app.reset()` will result in a new instance
|
83 | being fully-booted when the current runloop completes.
|
84 |
|
85 | We would like new code (like the `visit` API) to stop making this
|
86 | assumption, so we created the asynchronous version above that returns a
|
87 | promise. But until we have migrated all the code, we would have to expose
|
88 | this method for use *internally* in places where we need to boot an instance
|
89 | synchronously.
|
90 |
|
91 | @private
|
92 | */
|
93 | _bootSync(options?: BootOptions): this;
|
94 | setupRegistry(options?: BootOptions): void;
|
95 | /**
|
96 | Unregister a factory.
|
97 |
|
98 | Overrides `RegistryProxy#unregister` in order to clear any cached instances
|
99 | of the unregistered factory.
|
100 |
|
101 | @public
|
102 | @method unregister
|
103 | @param {String} fullName
|
104 | */
|
105 | unregister(fullName: FullName): void;
|
106 | /**
|
107 | Build a new `EngineInstance` that's a child of this instance.
|
108 |
|
109 | Engines must be registered by name with their parent engine
|
110 | (or application).
|
111 |
|
112 | @private
|
113 | @method buildChildEngineInstance
|
114 | @param name {String} the registered name of the engine.
|
115 | @param options {Object} options provided to the engine instance.
|
116 | @return {EngineInstance,Error}
|
117 | */
|
118 | buildChildEngineInstance(name: string, options?: EngineInstanceOptions): EngineInstance;
|
119 | /**
|
120 | Clone dependencies shared between an engine instance and its parent.
|
121 |
|
122 | @private
|
123 | @method cloneParentDependencies
|
124 | */
|
125 | cloneParentDependencies(): void;
|
126 | }
|
127 | export default EngineInstance;
|
128 | }
|