Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions types/ember/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,10 @@ declare module 'ember' {
* object when the boot process is complete.
*/
boot(): Promise<Application>;
/**
* Create an ApplicationInstance for this Application.
*/
buildInstance(options?: object): ApplicationInstance;
}
/**
The `ApplicationInstance` encapsulates all of the stateful aspects of a
Expand Down Expand Up @@ -1103,6 +1107,10 @@ declare module 'ember' {
* Set this to provide an alternate class to `Ember.DefaultResolver`
*/
resolver: Resolver;
/**
* Create an EngineInstance for this Engine.
*/
buildInstance(options?: object): EngineInstance;
}
/**
* The `EngineInstance` encapsulates all of the stateful aspects of a
Expand Down
6 changes: 6 additions & 0 deletions types/ember/test/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ let App2 = BaseApp.create({
mouseleave: null
}
});

let App3 = BaseApp.create();

let App3Instance1 = App3.buildInstance();

let App3Instance2 = App3.buildInstance({ foo: 'bar' });
41 changes: 41 additions & 0 deletions types/ember/test/engine.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import Ember from 'ember';
import { assertType } from "./lib/assert";

let BaseEngine = Ember.Engine.extend({
modulePrefix: 'my-engine'
});

BaseEngine.initializer({
name: 'my-initializer',
initialize(engine) {
engine.register('foo:bar', Ember.Object.extend({ foo: 'bar' }));
}
});

BaseEngine.instanceInitializer({
name: 'my-instance-initializer',
initialize(engine) {
engine.lookup('foo:bar').get('foo');
}
});

let Engine1 = BaseEngine.create({
rootElement: '#engine-one',
customEvents: {
paste: 'paste'
}
});

let Engine2 = BaseEngine.create({
rootElement: '#engine-two',
customEvents: {
mouseenter: null,
mouseleave: null
}
});

let Engine3 = BaseEngine.create();

let Engine3Instance1 = Engine3.buildInstance();

let Engine3Instance2 = Engine3.buildInstance({ foo: 'bar' });
1 change: 1 addition & 0 deletions types/ember/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"test/lib/assert.ts",
"test/application.ts",
"test/application-instance.ts",
"test/engine.ts",
"test/engine-instance.ts",
"test/ember-tests.ts",
"test/error.ts",
Expand Down