You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It happens that some cross component functionality can only [is more convenient to] be applied through actions, in those situations one may want to bundle it all in an object or a class with action methods directly applying the relevant state.
Unfortunately methods must at least be destructured and optionally bound to the relevant object before being used, all in seemingly unnecessary boilerplate repeated across every component
While const obj_action = obj.action.bind(obj); in the script block or the class constructor is not the end of the world, it still acts on readability, performance, bundle size and memory consumption, not to mention the ReturnType of bind is always any in typescript
Supporting object methods as actions requires the following changes
Allow action functions to be a MemberExpression whose object and property are both Identifiers ( currently only accepts a single Identifier )
Pass MemberExpression.object in the block ctx and call the relevant property name on mount
I'd like to suggest making methods valid actions that keep their contextual
this
, such as to make the following code valid :It happens that some cross component functionality can only [is more convenient to] be applied through actions, in those situations one may want to bundle it all in an object or a class with action methods directly applying the relevant state.
Unfortunately methods must at least be destructured and optionally bound to the relevant object before being used, all in seemingly unnecessary boilerplate repeated across every component
While
const obj_action = obj.action.bind(obj);
in the script block or the class constructor is not the end of the world, it still acts on readability, performance, bundle size and memory consumption, not to mention the ReturnType of bind is alwaysany
in typescriptSupporting object methods as actions requires the following changes
MemberExpression
whose object and property are bothIdentifier
s ( currently only accepts a singleIdentifier
)MemberExpression.object
in the blockctx
and call the relevant property name on mountThe text was updated successfully, but these errors were encountered: