whs.js icon indicating copy to clipboard operation
whs.js copied to clipboard

Core API

Open sasha240100 opened this issue 7 years ago • 2 comments

API

This issue exists for v2.x.x API discussion. Please, add your API suggestions in comments below

App

This class is used to prepare a world scene, setup physics, camera, renderer and all other things that you usually do before making meshes.

components

Component is a main class which is commonly used in core parts of WhitestormJS framework. Component is used in MeshComponent and almost all known classes of framework.

modules

Modules provide easy integration with components. They can make a lot of complex things much simpler to other developers (such as adding 3D physics).

Version:
  • [x] v2.x.x
  • [ ] v1.x.x
Issue type:
  • [ ] Bug
  • [ ] Proposal/Enhancement
  • [ ] Question
  • [x] Discussion

Tested on:
Desktop
  • [ ] Chrome
  • [ ] Chrome Canary
  • [ ] Chrome dev-channel
  • [ ] Firefox
  • [ ] Opera
  • [ ] Microsoft IE
  • [ ] Microsoft Edge
Android
  • [ ] Chrome
  • [ ] Firefox
  • [ ] Opera
IOS
  • [ ] Chrome
  • [ ] Firefox
  • [ ] Opera

sasha240100 avatar Mar 22 '17 18:03 sasha240100

/ping @thejmazz

sasha240100 avatar Mar 23 '17 14:03 sasha240100

One suggestion for the module API: swap this and self in integrate(self). Currently:

class Module {
  integrate(self) {
    // `this` is the app instance
    // `self` is the module instance
  }
}

let app = new WHS.App([new Module()]);

A new API would look like:

class Module {
  version = 2;  // Tell WHS to use a new module API. This way existing modules don't break.
  integrate(component) {
    // `this` is the module instance
    // `component` is the app instance
  }
}

ide avatar Oct 22 '17 01:10 ide