github cyclejs/cyclejs v0.13.0
v0.13.0 Small breaking change to custom elements

latest releases: unified-tag, v7.0.0, v7.0.0-rc8...
pre-release9 years ago

When registering a custom element, the definitionFn used to expect two parameters: element and Properties. With this breaking change, element is replaced with User.

The purpose is to prepare the API for the upcoming HTMLRenderer for server-side rendering, and also for reducing boilerplate, since any custom element implementation had to define a User in the same exact way: var User = Cycle.createDOMUser(element);.

Migration guide:
BEFORE

Cycle.registerCustomElement('my-element', function (element, Properties) {
  var View = Cycle.createView(function (Properties) {
    return {vtree$: Properties.get('foo$').map((x) => h('h3', String(x)))};
  });
  var User = Cycle.createDOMUser(element); // notice this
  User.inject(View);
});

AFTER

Cycle.registerCustomElement('my-element', function (User, Properties) {
  var View = Cycle.createView(function (Properties) {
    return {vtree$: Properties.get('foo$').map((x) => h('h3', String(x)))};
  });
  User.inject(View);
});

Don't miss a new cyclejs release

NewReleases is sending notifications on new releases.