mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
Add Ember Application/Engine#buildInstance()
This commit is contained in:
8
types/ember/index.d.ts
vendored
8
types/ember/index.d.ts
vendored
@@ -496,6 +496,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
|
||||
@@ -1113,6 +1117,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
|
||||
|
||||
@@ -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
types/ember/test/engine.ts
Executable file
41
types/ember/test/engine.ts
Executable file
@@ -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' });
|
||||
@@ -24,6 +24,7 @@
|
||||
"test/application.ts",
|
||||
"test/access-modifier.ts",
|
||||
"test/application-instance.ts",
|
||||
"test/engine.ts",
|
||||
"test/engine-instance.ts",
|
||||
"test/ember-tests.ts",
|
||||
"test/error.ts",
|
||||
|
||||
Reference in New Issue
Block a user