Skip to content

v0.24 - Cosmetic API improvement

Pre-release
Pre-release
Compare
Choose a tag to compare
@staltz staltz released this 15 Jun 15:08
· 3131 commits to master since this release

Small breaking change to improve the API related to driver responses. The getter API was replaced by object properties.

BEFORE

function main(drivers) {
  let vtree$ = drivers.get('DOM', '.target', 'click').flatMap( /* ... */ );
  // ...
}

AFTER

function main(drivers) {
  let vtree$ = drivers.DOM.get('.target', 'click').flatMap( /* ... */ );
  // ...
}

This allows using the drivers argument with ES6 destructuring:

function main({DOM, foo, bar}) {
  let vtree$ = DOM.get('.target', 'click').flatMap( /* ... */ );
  let F$ = foo.delay(1000);
  let B$ = bar.map( /* ... */ ).filter( /* ... */ );
  // ...
}

Given the argument drivers to main(), drivers.driverName will return the output of the driver function denoted by driverName. As you can see from the example above, the output might be a queryable (getable) collection of Observables such as DOM.get(selector, eventType) or simply an Observable, e.g. foo.delay(1000).


Changes to custom element internal drivers:

BEFORE: drivers.get('props', 'children')
AFTER: drivers.props.get('children')

To get all properties:
BEFORE: drivers.get('props', '*') or drivers.get('props')
AFTER: drivers.props.get('*') only