feat(core): Make top-level store methods available through shorthand
This commit is contained in:
parent
411f617ffe
commit
ef4a70c8f3
2 changed files with 35 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue