Supply Anchor ctor args as options object

This commit is contained in:
Tony Garnock-Jones 2018-11-11 17:19:43 +00:00
parent 87fecf517a
commit a75b48eb26
1 changed files with 5 additions and 7 deletions

View File

@ -434,21 +434,19 @@ function eventUpdater(eventType, handlerClosure, install) {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
export class Anchor { export class Anchor {
constructor(explicitFragmentId) { constructor(options) {
options = Object.assign({ fragmentId: void 0 }, options);
this.fragmentId = this.fragmentId =
(typeof explicitFragmentId === 'undefined') ? newFragmentId() : explicitFragmentId; (typeof options.fragmentId === 'undefined') ? newFragmentId() : options.fragmentId;
} }
context(...pieces) { context(...pieces) {
let extn = pieces.map(escapeDataAttributeName).join('__'); let extn = pieces.map(escapeDataAttributeName).join('__');
return new Anchor(this.fragmentId + '__' + extn); return new Anchor({ fragmentId: this.fragmentId + '__' + extn });
} }
html(selector, html, orderBy) { html(selector, html, orderBy) {
return P.UIFragment(this.fragmentId, return P.UIFragment(this.fragmentId, selector, html, orderBy === void 0 ? null : orderBy);
selector,
html,
orderBy === void 0 ? null : orderBy);
} }
} }