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);
});