npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

octane

v1.0.3

Published

MVCVM UI-Routing app framework with uni-directional dataflow

Downloads

21

Readme

Router

Router.add(pattern, callback) ⇒ this

Add a route to be called when the URL changes

Kind: static method of Router
Returns: this - for method chaining
Access: public

| Param | Type | Description | | --- | --- | --- | | pattern | regexp | string | A regexp pattern that matches a route against a URL. If passed as a string, beginning and trailing slashes will be stripped before being added to the routes array. | | callback | function | The callback to execute on a matching route, will be applied with the matched values of the route regexp |

Router.atRoot ⇒ boolean

Determine if the current location is the Application's root

Kind: static property of Router
Access: public
Read only: true

Router.beforePageLoad(page(s), deferred) ⇒ this

Add a Promise that must resolve before a page (or pages) can load

Kind: static method of Router
Returns: this - for method chaining
Access: public
See: OctanePage

| Param | Type | Description | | --- | --- | --- | | page(s) | string | array | The names of pages the condition should be evaluated for | | deferred | function | A deferred function that will be wrapped in a Promise |

Example

Octane.Router.beforePageLoad('about',function(resove,reject){...});

Router.clearRoutes()

Remove all routes from the Router

Kind: static method of Router
Access: public

Router.currentPage

Get the current page of the Application

Kind: static property of Router
Access: public
Read only: true

Router.isLocked ⇒ boolean

Is the router locked?

Kind: static property of Router
Access: public
Read only: true

Router.lock() ⇒ string

Lock the Router

Kind: static method of Router
Returns: string - A randomly generated key to unlock the router from THIS lock. Other locks may still be in place.
Access: public

Router.mode ⇒ object

Get the mode details of the application

Kind: static property of Router
Returns: object - Returns an object with keys history, hash, and local. Values are booleans
Access: public
Read only: true

Router.onPageExit(page(s), callback, [argsArray], [thisArg]) ⇒ this

Add a callback to the array of callbacks executed when a page has animated offscreen. Callbacks are wrapped in Promises at time of execution.

Kind: static method of Router
Returns: this - for method chaining
Access: public
See: OctanePage

| Param | Type | Description | | --- | --- | --- | | page(s) | string | array | The names of pages the callback should execute for | | callback | function | A callback to execute | | [argsArray] | array | An array of arguments to be applied to the callback at execution | | [thisArg] | object | The 'this' value of the callback at execution time, default is the Page object |

Router.onPageLoad(page(s), callback, [argsArray], [thisArg]) ⇒ this

Add a callback to the array of callbacks executed when a page has animated onscreen. Callbacks are wrapped in Promises at time of execution.

Kind: static method of Router
Returns: this - for method chaining
Access: public
See: OctanePage

| Param | Type | Description | | --- | --- | --- | | page(s) | string | array | The names of pages the callback should execute for | | callback | function | A callback to execute | | [argsArray] | array | An array of arguments to be applied to the callback at execution | | [thisArg] | object | The 'this' value of the callback at execution time, default is the Page object |

Example

// creates new Person with current values of Registrant ViewModel when page 'registrants' is loaded
Octane.Router.onPageLoad('registrants',
addNewPerson,
[octane.get('Registrant.name'),octane.get('Registrant.job')],
	Person);

Router.onUndefined()

Define a function to call in the event no routes exist on the specified path

Kind: static method of Router
Access: public

Router.pageLoadIf(page(s), predicate) ⇒ this

Add a predicate condition that must be true for a page(s) to load

Kind: static method of Router
Returns: this - for method chaining
Access: public
See: OctanePage

| Param | Type | Description | | --- | --- | --- | | page(s) | string | array | The names of page(s) the condition should be evaluated for | | predicate | function | A function that should return a truthy or falsy value |

Router.queue ⇒ array

Queued Pages waiting to load during a lock

Kind: static property of Router
Returns: array - the array of queued pages
Access: public
Read only: true

Router.remove(pattern)

Remove a route from the array of saved routes

Kind: static method of Router
Access: public

| Param | Type | Description | | --- | --- | --- | | pattern | regexp | The pattern to remove |

Router.route(route)

Determine hashing format and page from fragment, then use history.pushState or hashchange to set the route

Kind: static method of Router
Access: public

| Param | Type | Description | | --- | --- | --- | | route | string | Root-relative URL fragment to be mapped by Router._executeRoute |

Router.routes ⇒ array

List of routes registered with the Router

Kind: static property of Router
Returns: array - the array of registered routes
Access: public
Read only: true

Router.unlock(key) ⇒ boolean

Unlock the router from a calling of Router.lock. If the Router is locked, then after X number of failed unlocked attempts in a row, the Router will lock out and the Application will need to be restarted. Number of attempts can be set at Octane.initialize via appConfig.maxConsecutiveAllowedRouterUnlockAttemps, or defaults to 10

Kind: static method of Router
Returns: boolean - false if key is invalid or more locks remain, otherwise true and loads pages queued during lock
Throws:

  • Error thrown when the maximum number of consecutive failed unlocks is attempted. Router becomes permanently locked and Application will need restarted (prevent brute force unlocks)

Access: public

| Param | Type | Description | | --- | --- | --- | | key | string | The key returned from Router.lock to unlock the lock it placed. Other locks may still be in place. |

Router.urlSearchObject() ⇒ object

Helper to parse URL's search string into an object

Kind: static method of Router
Returns: object - an object of search parameters
Access: public
Example

Router.urlSearchObject("http://yoursite.com?pawns=5&kings=1")
=> {kings: 1, pawns: 5}

Router.useBrowserEvents()

Update App state on URL change. Turns off polling interval if set. Octane calls this during initilization, unless overridden by appConfig.legacyRouting: true.

Kind: static method of Router
Access: public

Router.usePolling()

Set fallback to use polling in case popstate/hashchange is being finicky. Drops popstate or hashchange event listeners.

Kind: static method of Router
Access: public