Add experimental once function
This commit is contained in:
parent
787bb390c0
commit
dffd83078b
|
|
@ -688,6 +688,16 @@ const Expose = add_alias({
|
|||
}
|
||||
},
|
||||
|
||||
once({ context, extra, position }) {
|
||||
let counter = 'once-counter' + position;
|
||||
return (...args) => {
|
||||
if (is_nil(context[counter])) {
|
||||
context[counter] = args;
|
||||
}
|
||||
return context[counter];
|
||||
}
|
||||
},
|
||||
|
||||
}, {
|
||||
|
||||
'index': 'i',
|
||||
|
|
|
|||
Loading…
Reference in New Issue