Skip to main content



WIP Package!

Integration for Vue

GitHub Licensenpm versionnpm minified sizenpm total downloads

โ“ vue#

The vue package helps us to integrate AgileTs into a Vue environment and serves as an Interface to Vue. Its main task is to bind States to Vue Components. This binding ensures that AgileTs rerender the Component whenever a bound State mutates. It also offers some other valuable functionalities that optimize the workflow using AgileTs in a Vue project.


The bindAgileInstances() method binds/subscribes States to Vue Components. This binding ensures that the Component rerenders whenever a bound State mutates. We can flexibly bind any State to any Vue Component.

export default {
name: 'MyComponent',
data: function () {
return {
myState: MY_STATE,

bindAgileInstances() returns a State value keymap based on the passed States. We merge the returned keymap into the data object to access the State values in the html code like we would local Vue States.

<div id="app">
<p>myState: {{ sharedState.myState }}</p>

Note that the AgileTs State values are under the sharedState property located to separate them from the local Vue States.

const MY_STATE = App.createState('jeff');
const MY_STATE_2 = App.createState('frank');
myState: MY_STATE,
myState2: MY_STATE_2,
}); // Returns '{myState: 'jeff', mayState2: 'frank'}'

Instead of a States keymap we can also pass an array of States. But keep in mind that then the passed States require a unique key to be properly mapped into the returned State value keymap.

const MY_STATE = App.createState('jeff', {key: 'myState'});
const MY_STATE_2 = App.createState('frank');
]); // Returns '{myState: 'jeff'}'

Passed States without a valid key are ignored and won't be represented by the returned keymap. Thus, the State value isn't accessible in the html code, and a State mutation rerender is triggered via. vueComponent.forceRerender() instead of mutating the data object.

๐ŸŸฆ Typescript#

The bindAgileInstances isn't typesafe yet. But we are working on it.

๐Ÿš€ Quick Links#

Last updated on