1
0
Fork 0

feat(core): Make top-level store methods available through shorthand

This commit is contained in:
Joost De Cock 2022-09-07 19:52:50 +02:00
parent 411f617ffe
commit ef4a70c8f3
2 changed files with 35 additions and 0 deletions

View file

@ -197,6 +197,13 @@ Part.prototype.shorthand = function () {
addCut: this.addCut,
removeCut: this.removeCut,
}
// Add top-level store methods and add a part name parameter
const partName = this.name
for (const [key, method] of Object.entries(this.context.store)) {
if (typeof method === 'function') shorthand[key] = function(...args) {
return method(partName, ...args)
}
}
// We'll need this
let self = this