Skip to content

Commit

Permalink
Adds types for DefineModule and adjusts elementModule constructor as …
Browse files Browse the repository at this point in the history
…container is optional - #298
  • Loading branch information
hirako2000 committed Jul 16, 2017
1 parent 0e21f2c commit 0621c11
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
9 changes: 9 additions & 0 deletions types/modules/DefineModule.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export class DefineModule {

/**
* @constructor Creates a define module.
* @param name name of the module
* @param data the module to define
*/
constructor(name: string, data: object);
}
4 changes: 2 additions & 2 deletions types/modules/app/ElementModule.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ export class ElementModule {

/**
* @constructor Creates an element module.
* @param container dom element to use as context for rendering
* @param container dom element to use as context for rendering. Default is document.body
*/
constructor(container: HTMLElement);
constructor(container?: HTMLElement);

/**
* Creates a div element inside the container
Expand Down
3 changes: 2 additions & 1 deletion types/modules/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './app';
export * from './mesh';
export * from './mesh';
export * from './DefineModule';
10 changes: 10 additions & 0 deletions types/whs-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ import {
VirtualMouseModule
} from './modules/app';

import {DefineModule} from './modules';

// Core
const app = new App();
app.start();
Expand Down Expand Up @@ -224,3 +226,11 @@ const data = stateModule.get('key');
const virtualMouseModule = new VirtualMouseModule();
virtualMouseModule.hovers(new Box(), false);
virtualMouseModule.track(new Sphere(), false);

const defineModule = new DefineModule('camera',
new PerspectiveCamera({
build: false,
far: 100
})
);
new App([defineModule]);

0 comments on commit 0621c11

Please sign in to comment.