Background Scripts
Setup
import Aragon from '@aragon/api'
const app = new Aragon(){
// name etc.
"script": "/dist/script.js"
}Building State
const state$ = app.store((state, event) => {
// Initial state is always null
if (state === null) state = 0
switch (event.event) {
case 'Increment':
state++
return state
case 'Decrement':
state--
return state
}
// We must always return a state, even if unaltered
return state
})Sharing State
Last updated
Was this helpful?
