
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
ractive-state-router
Advanced tools
Use Ractive with abstract-state-router!
npm + your favorite CommonJS bundler is easiest.
npm install ractive-state-router
You can also download the stand-alone build from bundle.run. If you include it in a <script> tag, a ractiveStateRouter function will be available on the global scope.
Version 9 drops support for ASR <= 7. Requires ASR 8 or later.
In version 7, the "active state" decorator changed from taking a string of state name/options to be parsed apart, to taking the state name, options object, and an optional class name.
const StateRouter = require('abstract-state-router')
const Ractive = require('ractive')
const makeRactiveStateRenderer = require('ractive-state-router')
const domready = require('domready')
const renderer = makeRactiveStateRenderer(Ractive)
const stateRouter = StateRouter(renderer, 'body')
// add whatever states to the state router
domready(function() {
stateRouter.evaluateCurrentRoute('login')
})
ractiveOptions is an object that is passed into Ractive.extend and takes Ractive's options.
options is an object with one optional property: deepCopyDataOnSet (defaults to false). When true, the content from the resolve function will be deep copied before being set on the Ractive object, in order to try to maintain the immutability of whatever objects you pass in.
const StateRouter = require('abstract-state-router')
const Ractive = require('ractive')
const RactiveRenderer = require('ractive-state-router')
const renderer = RactiveRenderer(Ractive, {
data: { hello: 'world' }
})
const stateRouter = StateRouter(renderer, 'body')
The active decorator adds the active class to an element if the given state is currently active. It takes three arguments: a state name (string), an optional parameters object, and a class name to be applied to the element if the state is active (defaults to 'active').
The makePath function from the abstract-state-router is also exposed.
<li as-active="'app.some-state', { parameter: 'somevalue' }, 'totally-active'">
<a href="{{ makePath('app.some-state') }}">Some state</a>
</li>
addStateWhen calling the abstract-state-router's addState function, you may provide any of these values as the template:
template property.FAQs
A RactiveJS-based rendering layer for the abstract-state-router
We found that ractive-state-router demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.