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

flux-router-component

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flux-router-component - npm Package Compare versions

Comparing version 0.0.6 to 0.1.0

.idea/.name

5

index.js

@@ -9,3 +9,4 @@ /**

NavLink: require('./lib/NavLink'),
RouterMixin: require('./lib/RouterMixin')
};
RouterMixin: require('./lib/RouterMixin'),
navigateAction: require('./actions/navigate')
};

14

lib/NavLink.js

@@ -9,3 +9,3 @@ /**

NavLink,
ACTION_NAVIGATE = 'NAVIGATE',
navigateAction = require('../actions/navigate'),
debug = require('debug')('NavLink');

@@ -15,7 +15,7 @@

dispatchNavAction: function (e) {
var dispatcher = this.props.dispatcher;
var context = this.props.context;
debug('dispatchNavAction: action=NAVIGATE path=' + this.props.href + ' params=' + JSON.stringify(this.props.navParams));
if (dispatcher) {
if (context) {
e.preventDefault();
dispatcher.dispatch(ACTION_NAVIGATE, {
context.executeAction(navigateAction, {
type: 'click',

@@ -30,5 +30,5 @@ path: this.props.href,

render: function() {
var router = this.props.router;
if (!this.props.href && this.props.name && router) {
this.props.href = router.makePath(this.props.name, this.props.navParams);
var context = this.props.context;
if (!this.props.href && this.props.name && context && context.makePath) {
this.props.href = context.makePath(this.props.name, this.props.navParams);
}

@@ -35,0 +35,0 @@ return this.transferPropsTo(

@@ -8,3 +8,3 @@ /**

var History = require('./History'),
ACTION_NAVIGATE = 'NAVIGATE',
navigateAction = require('../actions/navigate'),
EVT_PAGELOAD = 'pageload',

@@ -23,3 +23,3 @@ EVT_POPSTATE = 'popstate',

var self = this,
dispatcher = self.props.dispatcher,
context = self.props.context,
hash,

@@ -34,10 +34,10 @@ history;

// for the route represented by the hash fragment.
if (dispatcher && !history.hasPushState() && (hash = history.getHash())) {
dispatcher.dispatch(ACTION_NAVIGATE, {type: EVT_PAGELOAD, path: hash});
if (context && !history.hasPushState() && (hash = history.getHash())) {
context.executeAction(navigateAction, {type: EVT_PAGELOAD, path: hash});
}
self._routerPopstateListener = function (e) {
if (dispatcher) {
if (context) {
var path = history.getPath();
dispatcher.dispatch(ACTION_NAVIGATE, {type: EVT_POPSTATE, path: path, params: e.state});
context.executeAction(navigateAction, {type: EVT_POPSTATE, path: path, params: e.state});
}

@@ -57,3 +57,3 @@ };

}
var nav = newState.route.navigate || newState.navigate;
var nav = newState.route.navigate;
if (nav.type !== EVT_POPSTATE && nav.type !== EVT_PAGELOAD) {

@@ -60,0 +60,0 @@ this._routerHistory.pushState(nav.params || null, null, newState.route.path);

{
"name": "flux-router-component",
"version": "0.0.6",
"version": "0.1.0",
"description": "Router-related React component and mixin for applications with Flux architecture",

@@ -24,4 +24,3 @@ "main": "index.js",

"debug": "^1.0.0",
"react": "^0.10.0",
"routr": "^0.0.1"
"react": "^0.11.1"
},

@@ -39,3 +38,3 @@ "devDependencies": {

"precommit-hook": "^1.0.2",
"react-tools": "^0.10.0"
"react-tools": "^0.11.1"
},

@@ -42,0 +41,0 @@ "jshintConfig": {

@@ -15,3 +15,3 @@ # flux-router-component [![Build Status](https://travis-ci.org/yahoo/flux-router-component.svg?branch=master)](https://travis-ci.org/yahoo/flux-router-component) [![Dependency Status](https://david-dm.org/yahoo/flux-router-component.svg)](https://david-dm.org/yahoo/flux-router-component)

links,
dispatcher = this.props.dispatcher; // this is the Flux dispatcher object
context = this.props.context; // this should have a router instance and an executeAction function
pages = [

@@ -32,3 +32,3 @@ {

<li className="navItem">
<NavLink href={page.url} dispatcher={dispatcher}>
<NavLink href={page.url} context={context}>
{page.text}

@@ -50,6 +50,6 @@ </NavLink>

## RouterMixin
`RouterMixin` is a React mixin to be used by appication's top level React component to:
`RouterMixin` is a React mixin to be used by application's top level React component to:
* manage browser history when route changes, and
* dispatch `NAVIGATE` action via flux dispatcher on window `popstate` events
* execute navigate action and then dispatch `CHANGE_ROUTE` event via flux dispatcher on window `popstate` events

@@ -56,0 +56,0 @@

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