fluxxor icon indicating copy to clipboard operation
fluxxor copied to clipboard

Export Store

Open mrk21 opened this issue 9 years ago • 0 comments

I changed to export the lib/store module. By using this directly, we will be able to create stores by using ES6 Classes style.

For example in TypeScript:

import Fluxxor = require('fluxxor');

interface MyStoreOption {
  value: number;
}

class MyStore extends Fluxxor.Store {
  options: MyStoreOption;

  constructor(options: MyStoreOption) {
    super();
    this.options = options;
    this.bindActions("ACTION_TYPE", this.handleActionType.bind(this));
  }

  handleActionType(payload: number) {
    // ...
  }
}

var myStore = new MyStore({value: 123});

In addition, this style is compatible with static typing languages such as TypeScript.

mrk21 avatar Feb 16 '15 07:02 mrk21