Skip to content

Commit

Permalink
feat(state): fire state changing as microtask
Browse files Browse the repository at this point in the history
  • Loading branch information
nattallius committed Jan 19, 2022
1 parent 5795e07 commit 1d16afe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/base/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class UIPStateModel extends Observable {
if (!root || root.innerHTML !== this.html) {
this._html = root;
this._lastModifier = modifier;
this.fire();
Promise.resolve().then(() => this.fire());
}
}

Expand Down Expand Up @@ -74,7 +74,7 @@ export class UIPStateModel extends Observable {

UIPStateModel.setAttribute(elements, attribute, 'transform' in cfg ? cfg.transform : cfg.value);
this._lastModifier = modifier;
this.fire();
Promise.resolve().then(() => this.fire());
}

protected static setAttribute(elements: Element[], attr: string, transform: TransformSignature | string | boolean) {
Expand All @@ -83,7 +83,7 @@ export class UIPStateModel extends Observable {
if (typeof transformed === 'string') {
el.setAttribute(attr, transformed);
} else {
transformed ? el.setAttribute(attr, '') : el.removeAttribute(attr);
transformed ? el.setAttribute(attr, '') : el.removeAttribute(attr);
}
});
}
Expand Down

0 comments on commit 1d16afe

Please sign in to comment.