🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

navigate

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

navigate

A router for the browser (client-side JavaScript).

latest
Source
npmnpm
Version
0.3.6
Version published
Weekly downloads
291
37.26%
Maintainers
1
Weekly downloads
 
Created
Source

navigate

A router for the browser (client-side JavaScript).

  • Overview
  • Installation
  • API
  • Development

Overview

  • Has no dependencies.
  • Supports Asynchronous Module Loader (AMD, RequireJS), CommonJS (Node.js require) and regular <script> loading.
  • If HTML5 History API is not available, falls back to hashes.
  • Handles click events on same origin links.
  • Tested on these browsers:
    • Mozilla Firefox 1.0+
    • Opera 8.00+
    • Google Chrome 1+
    • Microsoft Internet Explorer 6+
    • Apple Safari 3.0+

Installation

Install manually by adding to your HTML file:

<script src="/path/to/navigate/navigate.js"></script>

Install with npm:

$ npm install --save navigate

Install with component:

$ component install jakutis/navigate

Install with bower:

$ bower install --save navigate

API

// configure, can be called anytime at all (including never)
navigate({
    // whether same origin a.href clicks are captured
    clickHandlingEnabled : true,
    // URL path prefix
    basePath : ''
});

// initialize
navigate();

// get current page (also initialize, if not initialized)
navigate(function(entryPage) {
    console.log('Entry page to this web app is ' + entryPage);
});

// handle navigations to /user/* pages
navigate(/^\/user\/(.+)$/, function(args, from, to) {
    console.log('Navigated from page ' + from + ' to ' + to);
    console.log('Showing user ' + args[0]);
});

// navigate to user's "tahu" page
navigate('/user/tahu');

Development

TODO

Keywords

router

FAQs

Package last updated on 11 Nov 2017

Did you know?

Socket

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.

Install

Related posts