Settings

Theme

Orbit.js – a framework for orchestrating data access and synchronization

orbitjs.com

18 points by dgeb 8 years ago · 2 comments

Reader

rockostrich 8 years ago

When you have this:

    store.on('transform', (transform) => {
      return backup.sync(transform);
    });
And then this right after it:

    store.on('transform', (transform) => backup.sync(transform));
You're writing meaningless documentation. The project looks cool, but I can't take it seriously when the Getting Started guide panders to the reader.
  • dgebOP 8 years ago

    I find that a lot of developers will use the briefer implicit return form (`transform => backup.sync(transform)`) of a function without focusing on whether the returned value has significance.

    I wanted to write out the explicit `return` form of the handler to emphasize that returning a promise in an Orbit event handler has significance. It delays resolution of the event, thereby allowing listeners to participate in that resolution.

    Perhaps it was unnecessary for me to _also_ include the implicit return form in that example. However, that's the way I would normally write this function, and I'd like to present "best practices" and show how concise the code is typically.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection