goatslacker / alt

Isomorphic flux implementation
http://alt.js.org/
3.45k stars 322 forks source link

Add lifecycle event for listen #534

Open aajtodd opened 8 years ago

aajtodd commented 8 years ago

Documentation shows a lifecycle event exists for unlisten on stores. It would be beneficial to also have the listen lifecycle event exposed.

Also some documentation on using lifecycle events in es5 would be helpful.

goatslacker commented 8 years ago

I'd gladly accept a pull request adding a listen lifecycle method.

In ES5 you'd put lifecycle methods like:

function TodoStore() {
  this.on('unlisten', function () {
    // do something
  })
}

// or

var TodoStore = alt.createStore({
  lifecycle: {
    unlisten: function () {
      // do someting
    }
  }
})
goatslacker commented 8 years ago

Oops, reopening for adding a listen lifecycle method.