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
thx for creating this fantastic implementation of BT!
In my use case I want to update the style (css) of a certain element and I wonder how to pass a "context" (e.g. an arbitrary state object) into the agent, that would then update the state in the BT.Action.
In the following code snippet you can see how pass some context in - but i wonder how to get it out again?
So the library can't pass any custom state when invoking any agent functions, the library was designed to avoid having to deal with any agent state and to only be concerned with behaviours. The idea is that any state would already be accessible to the functions invoked by mistreevous.
In your scenario is it not possible to add the state to the agent that you are creating in getAgent and just have isHeaderFixed reference that?
It's a little difficult to give you an answer without clearer picture of your actual implementation and how/where getAgent is being called.
Hi there,
thx for creating this fantastic implementation of BT!
In my use case I want to update the style (css) of a certain element and I wonder how to pass a "context" (e.g. an arbitrary state object) into the agent, that would then update the state in the BT.Action.
In the following code snippet you can see how pass some context in - but i wonder how to get it out again?
Thank you!
export const getAgent = (state: Signal<GridItemState>) => { return { isHeaderFixed: () => { console.log('Checking if header is fixed: ', state.value.r1c2.fixed); return state.value.r1c2.fixed ? true : false; }, setHeaderPosition: () => { console.log('Setting header position ', this); return State.SUCCEEDED; } }; }
The text was updated successfully, but these errors were encountered: