Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cf-util-route-handler

Package Overview
Dependencies
Maintainers
8
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cf-util-route-handler - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

lib/routeHandler.js

21

lib/index.js
'use strict';
exports.__esModule = true;
exports.handleRoutes = handleRoutes;
exports.routeTo = routeTo;
var handler = undefined;
function handleRoutes(callback) {
if (handler) {
throw new Error('Only one handler is allowed at a time');
}
handler = callback;
}
function routeTo(url) {
if (!handler) {
throw new Error('A handler needs to be setup before you can route');
}
handler(url);
}
module.exports = require('./routeHandler');
{
"name": "cf-util-route-handler",
"description": "CloudFlare Route Handler Util",
"version": "1.0.0",
"version": "2.0.0",
"main": "lib/index.js",
"scripts": {
"build": "babel src -d lib",
"example": "browserify example/script.js -o example/bundle.js -t babelify --debug",
"format": "jsfmt -w *.js src/ test/",
"lint": "eslint *.js src/ test/",
"prepublish": "npm run build",
"test": "karma start"
},
"author": "James Kyle <me@thejameskyle.com>",

@@ -18,27 +10,5 @@ "license": "BSD-3-Clause",

"devDependencies": {
"babel-cli": "^6.1.1",
"babel-core": "^6.0.20",
"babel-preset-cf": "^1.2.0",
"babelify": "^7.2.0",
"backbone": "^1.2.3",
"browserify-istanbul": "^0.2.1",
"chai": "^3.4.1",
"defined": "^1.0.0",
"eslint": "^1.8.0",
"jquery": "^2.1.4",
"jsfmt": "^0.5.2",
"karma": "^0.13.15",
"karma-beep-reporter": "^0.1.4",
"karma-browserify": "^4.4.0",
"karma-chrome-launcher": "^0.2.1",
"karma-coverage": "^0.5.3",
"karma-firefox-launcher": "^0.1.6",
"karma-mocha": "^0.2.0",
"karma-mocha-reporter": "^1.1.1",
"karma-safari-launcher": "^0.1.1",
"karma-sauce-launcher": "^0.3.0",
"karma-tape-reporter": "^1.0.3",
"minimist": "^1.2.0",
"mocha": "^2.3.3"
"jquery": "^2.1.4"
}
}

@@ -14,7 +14,9 @@ # cf-util-route-handler

```js
import {handleRoutes, routeTo} from 'cf-util-route-handler';
import backboneAdapter from 'cf-util-route-handler/lib/backbone-adapter';
const {handleRoutes, routeTo} = require('cf-util-route-handler');
const Backbone = require('backbone');
// setup the router
handleRoutes(backboneAdapter);
handleRoutes(function(url) {
Backbone.history.navigate(url, true);
});

@@ -21,0 +23,0 @@ // do all the world to make the router work normally

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc