Skip to content

πŸ”— Base class upon which to build Kindred components

License

Notifications You must be signed in to change notification settings

kindredjs/kindred-component

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

kindred-component

Base class upon which to build Kindred components. Most of the functionality for consuming these components can be found in kindred-node.

Usage

kindred-component is designed to be used with ES6 classes. You may need to use a transpiler such as Babel to support older browsers.

const Component = require('kindred-component')

// Each component must have a unique string id, e.g. here it's "custom":
class CustomComponent extends Component('custom') {
  init () {
    // called when the component is first created
  }

  step () {
    // called once per frame, intended for logic such
    // as physics simulation and event handling
  }

  draw () {
    // called once per frame, intended for anything
    // related to rendering.
  }

  stop () {
    // called when the component is no longer being used.
    // use this to clean up after yourself.
  }
}

module.exports = CustomComponent

License

MIT. See LICENSE.md for details.

About

πŸ”— Base class upon which to build Kindred components

Resources

License

Stars

Watchers

Forks

Packages

No packages published