diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 885eaafbbd..3583889a74 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -480,6 +480,11 @@ declare module 'ember' { **/ Router: Router; registry: Registry; + /** + * Initialize the application and return a promise that resolves with the `Application` + * object when the boot process is complete. + */ + boot(): Promise; } /** The `ApplicationInstance` encapsulates all of the stateful aspects of a @@ -1111,6 +1116,12 @@ declare module 'ember' { * Unregister a factory. */ unregister(fullName: string): any; + + /** + * Initialize the `EngineInstance` and return a promise that resolves + * with the instance itself when the boot process is complete. + */ + boot(): Promise; } /** * This mixin defines the common interface implemented by enumerable objects diff --git a/types/ember/test/application-instance.ts b/types/ember/test/application-instance.ts index 5b973b37c4..9881e4815a 100644 --- a/types/ember/test/application-instance.ts +++ b/types/ember/test/application-instance.ts @@ -18,3 +18,9 @@ appInstance.register('some:injection', class Foo {}, { appInstance.factoryFor('router:main'); appInstance.lookup('route:basic'); + +appInstance.boot(); + +(async function() { + await appInstance.boot(); +}()); diff --git a/types/ember/test/engine-instance.ts b/types/ember/test/engine-instance.ts new file mode 100644 index 0000000000..c74914dea5 --- /dev/null +++ b/types/ember/test/engine-instance.ts @@ -0,0 +1,26 @@ +import EngineInstance from '@ember/engine/instance'; + +const engineInstance = EngineInstance.create(); +engineInstance.register('some:injection', class Foo {}); + +engineInstance.register('some:injection', class Foo {}, { + singleton: true, +}); + +engineInstance.register('some:injection', class Foo {}, { + instantiate: false, +}); + +engineInstance.register('some:injection', class Foo {}, { + singleton: false, + instantiate: true, +}); + +engineInstance.factoryFor('router:main'); +engineInstance.lookup('route:basic'); + +engineInstance.boot(); + +(async function() { + await engineInstance.boot(); +}()); diff --git a/types/ember/tsconfig.json b/types/ember/tsconfig.json index b4bc966044..676c107f72 100755 --- a/types/ember/tsconfig.json +++ b/types/ember/tsconfig.json @@ -23,6 +23,7 @@ "test/lib/assert.ts", "test/application.ts", "test/application-instance.ts", + "test/engine-instance.ts", "test/ember-tests.ts", "test/error.ts", "test/event.ts",