Hooks
Learn how to hook into the Spruce lifecycle.
Spruce goes through various steps during it's lifecycle on a website. Hooks can be used to execute code at certain points in Spruce's execution cycle.
Spruce.starting()
This hook can be used to invoke a function before Spruce has fully initialised and before any global stores are being watched.
Spruce.starting(function () {
console.log('Spruce is starting...')
})
Spruce.started()
This hook can be used to invoke a function after Spruce has fully initialised and after any global stores are being watched.
Spruce.started(function () {
console.log('I can access Proxy instances here...')
})
Last updated
Was this helpful?