feat(Extensions): prototype extensions refactor
Description
Prototype implementation of applying extensions at setTheme time to Component prototypes rather than at instance construct time.
Extensions take an array of imported component references rather than component names
const extensions = [
{
components: [Surface],
extension: WithRedRect,
},
]
Extensions are just classes, and super calls are replaces by this custom next implementation
class WithRedRect {
_update(next) {
// super calls are replaced with next
// this can be bound during applyExtensions instead, but think this may be technically faster.
if (next) {
next.apply(this)
}
this.patch({
PopupRed: {
rect: true,
w: 100,
h: 100,
x: 10,
y: 10,
color: 0xffff0000,
zIndex: 100,
},
})
}
_cleanupExtension() {
this.patch({
PopupRed: undefined,
})
}
}
Results in roughly 15-20% faster component construct/init time. Perf. was measured creating a column of 4 rows of 8 tiles.
Before:
After:
References
https://ccp.sys.comcast.net/projects/LUI/issues/LUI-1329
Automation
Checklist
- [ ] all commented code has been removed
- [ ] any new console issues have been resolved
- [ ] code linter and formatter has been run
- [ ] test coverage meets repo requirements
- [ ] PR name matches the expected semantic-commit syntax
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
ChrisArasin seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.
Test Execution Failed.
Closing, no recent updates.