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

alt

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alt - npm Package Compare versions

Comparing version 0.10.2 to 0.11.0

998

dist/alt.js

@@ -1,12 +0,12 @@

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Alt=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
"use strict";
var _slice = Array.prototype.slice;
"use strict";
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var Dispatcher = _dereq_("flux").Dispatcher;
var EventEmitter = _dereq_("eventemitter3");
var Symbol = _dereq_("./polyfills/es6-symbol");
var assign = _dereq_("object-assign");
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Dispatcher = require("flux").Dispatcher;
var EventEmitter = require("eventemitter3");
var Symbol = require("es-symbol");
var assign = require("object-assign");
var now = Date.now();

@@ -21,2 +21,3 @@ var VariableSymbol = function (desc) {

var ACTION_UID = Symbol("the actions uid name");
var BOOTSTRAP_FLAG = VariableSymbol("has bootstrap");
var EE = Symbol("event emitter instance");

@@ -54,4 +55,6 @@ var INIT_SNAPSHOT = Symbol("init snapshot storage");

var AltStore = (function () {
var AltStore = function AltStore(dispatcher, state) {
function AltStore(dispatcher, state) {
var _this = this;
_classCallCheck(this, AltStore);
this[STATE_CONTAINER] = state;

@@ -73,21 +76,36 @@ this[EE] = new EventEmitter();

});
};
}
AltStore.prototype.emitChange = function () {
this[EE].emit("change", this[STATE_CONTAINER]);
};
_prototypeProperties(AltStore, null, {
emitChange: {
value: function emitChange() {
this[EE].emit("change", this[STATE_CONTAINER]);
},
writable: true,
configurable: true
},
listen: {
value: function listen(cb) {
this[EE].on("change", cb);
},
writable: true,
configurable: true
},
unlisten: {
value: function unlisten(cb) {
this[EE].removeListener("change", cb);
},
writable: true,
configurable: true
},
getState: {
value: function getState() {
// Copy over state so it's RO.
return assign({}, this[STATE_CONTAINER]);
},
writable: true,
configurable: true
}
});
AltStore.prototype.listen = function (cb) {
this[EE].on("change", cb);
};
AltStore.prototype.unlisten = function (cb) {
this[EE].removeListener("change", cb);
};
AltStore.prototype.getState = function () {
// Copy over state so it's RO.
return assign({}, this[STATE_CONTAINER]);
};
return AltStore;

@@ -97,15 +115,24 @@ })();

var ActionCreator = (function () {
var ActionCreator = function ActionCreator(dispatcher, name, action, actions) {
function ActionCreator(dispatcher, name, action, actions) {
_classCallCheck(this, ActionCreator);
this[ACTION_DISPATCHER] = dispatcher;
this[ACTION_UID] = name;
this[ACTION_HANDLER] = action.bind(this);
this[BOOTSTRAP_FLAG] = false;
this.actions = actions;
};
}
ActionCreator.prototype.dispatch = function (data) {
this[ACTION_DISPATCHER].dispatch({
action: this[ACTION_UID],
data: data
});
};
_prototypeProperties(ActionCreator, null, {
dispatch: {
value: function dispatch(data) {
this[ACTION_DISPATCHER].dispatch({
action: this[ACTION_UID],
data: data
});
},
writable: true,
configurable: true
}
});

@@ -116,3 +143,3 @@ return ActionCreator;

var StoreMixin = {
bindAction: function (symbol, handler) {
bindAction: function bindAction(symbol, handler) {
if (!symbol) {

@@ -137,4 +164,4 @@ throw new ReferenceError("Invalid action reference passed in");

bindActions: function (actions) {
var _this2 = this;
bindActions: function bindActions(actions) {
var _this = this;
Object.keys(actions).forEach(function (action) {

@@ -148,15 +175,15 @@ var symbol = actions[action];

if (_this2[action] && _this2[assumedEventHandler]) {
if (_this[action] && _this[assumedEventHandler]) {
// If you have both action and onAction
throw new ReferenceError("You have multiple action handlers bound to an action: " + ("" + action + " and " + assumedEventHandler));
} else if (_this2[action]) {
} else if (_this[action]) {
// action
handler = _this2[action];
} else if (_this2[assumedEventHandler]) {
handler = _this[action];
} else if (_this[assumedEventHandler]) {
// onAction
handler = _this2[assumedEventHandler];
handler = _this[assumedEventHandler];
}
if (handler) {
_this2.bindAction(symbol, handler);
_this.bindAction(symbol, handler);
}

@@ -166,3 +193,3 @@ });

waitFor: function (tokens) {
waitFor: function waitFor(tokens) {
if (!tokens) {

@@ -176,3 +203,3 @@ throw new ReferenceError("Dispatch tokens not provided");

var bootstrap = function (instance, data) {
var setAppState = function (instance, data) {
var obj = JSON.parse(data);

@@ -217,3 +244,5 @@ Object.keys(obj).forEach(function (key) {

var Alt = (function () {
var Alt = function Alt() {
function Alt() {
_classCallCheck(this, Alt);
this.dispatcher = new Dispatcher();

@@ -223,114 +252,145 @@ this.stores = {};

this[INIT_SNAPSHOT] = "{}";
};
}
Alt.prototype.createStore = function (StoreModel, iden) {
var _this3 = this;
var key = iden || StoreModel.displayName || StoreModel.name;
// Creating a class here so we don't overload the provided store's
// prototype with the mixin behaviour and I'm extending from StoreModel
// so we can inherit any extensions from the provided store.
function Store() {
StoreModel.call(this);
}
Store.prototype = StoreModel.prototype;
Store.prototype[LISTENERS] = {};
assign(Store.prototype, StoreMixin, {
_storeName: key,
dispatcher: this.dispatcher,
getInstance: function () {
return _this3.stores[key];
}
});
_prototypeProperties(Alt, null, {
createStore: {
value: function createStore(StoreModel, iden) {
var _this = this;
var key = iden || StoreModel.displayName || StoreModel.name;
// Creating a class here so we don't overload the provided store's
// prototype with the mixin behaviour and I'm extending from StoreModel
// so we can inherit any extensions from the provided store.
function Store() {
StoreModel.call(this);
}
Store.prototype = StoreModel.prototype;
Store.prototype[LISTENERS] = {};
assign(Store.prototype, StoreMixin, {
_storeName: key,
dispatcher: this.dispatcher,
getInstance: function () {
return _this.stores[key];
}
});
var store = new Store();
var store = new Store();
if (this.stores[key]) {
throw new ReferenceError("A store named " + key + " already exists, double check your store names or pass in\nyour own custom identifier for each store");
}
if (this.stores[key]) {
throw new ReferenceError("A store named " + key + " already exists, double check your store names or pass in\nyour own custom identifier for each store");
}
this.stores[key] = assign(new AltStore(this.dispatcher, store), getInternalMethods(StoreModel, builtIns));
this.stores[key] = assign(new AltStore(this.dispatcher, store), getInternalMethods(StoreModel, builtIns));
saveInitialSnapshot(this, key);
saveInitialSnapshot(this, key);
return this.stores[key];
};
return this.stores[key];
},
writable: true,
configurable: true
},
createActions: {
value: function createActions(ActionsClass) {
var _this = this;
var exportObj = arguments[1] === undefined ? {} : arguments[1];
var key = ActionsClass.displayName || ActionsClass.name;
var actions = assign({}, getInternalMethods(ActionsClass.prototype, builtInProto));
Alt.prototype.createActions = function (ActionsClass, exportObj) {
var _this4 = this;
if (exportObj === undefined) exportObj = {};
var key = ActionsClass.displayName || ActionsClass.name;
var actions = assign({}, getInternalMethods(ActionsClass.prototype, builtInProto));
function ActionsGenerator() {
ActionsClass.call(this);
}
ActionsGenerator.prototype = ActionsClass.prototype;
ActionsGenerator.prototype.generateActions = function () {
for (var _len = arguments.length, actionNames = Array(_len), _key = 0; _key < _len; _key++) {
actionNames[_key] = arguments[_key];
}
function ActionsGenerator() {
ActionsClass.call(this);
}
ActionsGenerator.prototype = ActionsClass.prototype;
ActionsGenerator.prototype.generateActions = function () {
var actionNames = _slice.call(arguments);
actionNames.forEach(function (actionName) {
// This is a function so we can later bind this to ActionCreator
actions[actionName] = function (x) {
for (var _len2 = arguments.length, a = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
a[_key2 - 1] = arguments[_key2];
}
actionNames.forEach(function (actionName) {
// This is a function so we can later bind this to ActionCreator
actions[actionName] = function (x) {
var a = _slice.call(arguments, 1);
this.dispatch(a.length ? [x].concat(a) : x);
this.dispatch(a.length ? [x].concat(a) : x);
};
});
};
});
};
new ActionsGenerator();
new ActionsGenerator();
return Object.keys(actions).reduce(function (obj, action) {
var constant = formatAsConstant(action);
var actionName = Symbol("action " + key + ".prototype." + action);
return Object.keys(actions).reduce(function (obj, action) {
var constant = formatAsConstant(action);
var actionName = Symbol("action " + key + ".prototype." + action);
// Wrap the action so we can provide a dispatch method
var newAction = new ActionCreator(_this4.dispatcher, actionName, actions[action], obj);
// Wrap the action so we can provide a dispatch method
var newAction = new ActionCreator(_this.dispatcher, actionName, actions[action], obj);
// Set all the properties on action
obj[action] = newAction[ACTION_HANDLER];
obj[action].defer = function (x) {
return setTimeout(function () {
return newAction[ACTION_HANDLER](x);
});
};
obj[action][ACTION_KEY] = actionName;
obj[constant] = actionName;
// Set all the properties on action
obj[action] = newAction[ACTION_HANDLER];
obj[action].defer = function (x) {
return setTimeout(function () {
return newAction[ACTION_HANDLER](x);
});
};
obj[action][ACTION_KEY] = actionName;
obj[constant] = actionName;
return obj;
}, exportObj);
};
return obj;
}, exportObj);
},
writable: true,
configurable: true
},
takeSnapshot: {
value: function takeSnapshot() {
var state = snapshot(this);
this[LAST_SNAPSHOT] = state;
return state;
},
writable: true,
configurable: true
},
rollback: {
value: function rollback() {
setAppState(this, this[LAST_SNAPSHOT]);
},
writable: true,
configurable: true
},
recycle: {
value: function recycle() {
for (var _len = arguments.length, storeNames = Array(_len), _key = 0; _key < _len; _key++) {
storeNames[_key] = arguments[_key];
}
Alt.prototype.takeSnapshot = function () {
var state = snapshot(this);
this[LAST_SNAPSHOT] = state;
return state;
};
var snapshot = storeNames.length ? filterSnapshotOfStores(this[INIT_SNAPSHOT], storeNames) : this[INIT_SNAPSHOT];
Alt.prototype.rollback = function () {
bootstrap(this, this[LAST_SNAPSHOT]);
};
Alt.prototype.recycle = function () {
var storeNames = _slice.call(arguments);
var _snapshot = storeNames.length ? filterSnapshotOfStores(this[INIT_SNAPSHOT], storeNames) : this[INIT_SNAPSHOT];
bootstrap(this, _snapshot);
};
Alt.prototype.flush = function () {
var state = snapshot(this);
this.recycle();
return state;
};
Alt.prototype.bootstrap = function (data) {
bootstrap(this, data);
if (typeof window !== "undefined") {
this.bootstrap = function () {
throw new ReferenceError("Stores have already been bootstrapped");
};
setAppState(this, snapshot);
},
writable: true,
configurable: true
},
flush: {
value: function flush() {
var state = snapshot(this);
this.recycle();
return state;
},
writable: true,
configurable: true
},
bootstrap: {
value: function bootstrap(data) {
setAppState(this, data);
if (typeof window !== "undefined") {
if (this[BOOTSTRAP_FLAG]) {
throw new ReferenceError("Stores have already been bootstrapped");
}
this[BOOTSTRAP_FLAG] = true;
}
},
writable: true,
configurable: true
}
};
});

@@ -342,661 +402,1 @@ return Alt;

},{"./polyfills/es6-symbol":7,"eventemitter3":2,"flux":3,"object-assign":6}],2:[function(_dereq_,module,exports){
'use strict';
/**
* Representation of a single EventEmitter function.
*
* @param {Function} fn Event handler to be called.
* @param {Mixed} context Context for function execution.
* @param {Boolean} once Only emit once
* @api private
*/
function EE(fn, context, once) {
this.fn = fn;
this.context = context;
this.once = once || false;
}
/**
* Minimal EventEmitter interface that is molded against the Node.js
* EventEmitter interface.
*
* @constructor
* @api public
*/
function EventEmitter() { /* Nothing to set */ }
/**
* Holds the assigned EventEmitters by name.
*
* @type {Object}
* @private
*/
EventEmitter.prototype._events = undefined;
/**
* Return a list of assigned event listeners.
*
* @param {String} event The events that should be listed.
* @returns {Array}
* @api public
*/
EventEmitter.prototype.listeners = function listeners(event) {
if (!this._events || !this._events[event]) return [];
if (this._events[event].fn) return [this._events[event].fn];
for (var i = 0, l = this._events[event].length, ee = new Array(l); i < l; i++) {
ee[i] = this._events[event][i].fn;
}
return ee;
};
/**
* Emit an event to all registered event listeners.
*
* @param {String} event The name of the event.
* @returns {Boolean} Indication if we've emitted an event.
* @api public
*/
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
if (!this._events || !this._events[event]) return false;
var listeners = this._events[event]
, len = arguments.length
, args
, i;
if ('function' === typeof listeners.fn) {
if (listeners.once) this.removeListener(event, listeners.fn, true);
switch (len) {
case 1: return listeners.fn.call(listeners.context), true;
case 2: return listeners.fn.call(listeners.context, a1), true;
case 3: return listeners.fn.call(listeners.context, a1, a2), true;
case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
}
for (i = 1, args = new Array(len -1); i < len; i++) {
args[i - 1] = arguments[i];
}
listeners.fn.apply(listeners.context, args);
} else {
var length = listeners.length
, j;
for (i = 0; i < length; i++) {
if (listeners[i].once) this.removeListener(event, listeners[i].fn, true);
switch (len) {
case 1: listeners[i].fn.call(listeners[i].context); break;
case 2: listeners[i].fn.call(listeners[i].context, a1); break;
case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
default:
if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
args[j - 1] = arguments[j];
}
listeners[i].fn.apply(listeners[i].context, args);
}
}
}
return true;
};
/**
* Register a new EventListener for the given event.
*
* @param {String} event Name of the event.
* @param {Functon} fn Callback function.
* @param {Mixed} context The context of the function.
* @api public
*/
EventEmitter.prototype.on = function on(event, fn, context) {
var listener = new EE(fn, context || this);
if (!this._events) this._events = {};
if (!this._events[event]) this._events[event] = listener;
else {
if (!this._events[event].fn) this._events[event].push(listener);
else this._events[event] = [
this._events[event], listener
];
}
return this;
};
/**
* Add an EventListener that's only called once.
*
* @param {String} event Name of the event.
* @param {Function} fn Callback function.
* @param {Mixed} context The context of the function.
* @api public
*/
EventEmitter.prototype.once = function once(event, fn, context) {
var listener = new EE(fn, context || this, true);
if (!this._events) this._events = {};
if (!this._events[event]) this._events[event] = listener;
else {
if (!this._events[event].fn) this._events[event].push(listener);
else this._events[event] = [
this._events[event], listener
];
}
return this;
};
/**
* Remove event listeners.
*
* @param {String} event The event we want to remove.
* @param {Function} fn The listener that we need to find.
* @param {Boolean} once Only remove once listeners.
* @api public
*/
EventEmitter.prototype.removeListener = function removeListener(event, fn, once) {
if (!this._events || !this._events[event]) return this;
var listeners = this._events[event]
, events = [];
if (fn) {
if (listeners.fn && (listeners.fn !== fn || (once && !listeners.once))) {
events.push(listeners);
}
if (!listeners.fn) for (var i = 0, length = listeners.length; i < length; i++) {
if (listeners[i].fn !== fn || (once && !listeners[i].once)) {
events.push(listeners[i]);
}
}
}
//
// Reset the array, or remove it completely if we have no more listeners.
//
if (events.length) {
this._events[event] = events.length === 1 ? events[0] : events;
} else {
delete this._events[event];
}
return this;
};
/**
* Remove all listeners or only the listeners for the specified event.
*
* @param {String} event The event want to remove all listeners for.
* @api public
*/
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
if (!this._events) return this;
if (event) delete this._events[event];
else this._events = {};
return this;
};
//
// Alias methods names because people roll like that.
//
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
//
// This function doesn't apply anymore.
//
EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
return this;
};
//
// Expose the module.
//
EventEmitter.EventEmitter = EventEmitter;
EventEmitter.EventEmitter2 = EventEmitter;
EventEmitter.EventEmitter3 = EventEmitter;
//
// Expose the module.
//
module.exports = EventEmitter;
},{}],3:[function(_dereq_,module,exports){
/**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
module.exports.Dispatcher = _dereq_('./lib/Dispatcher')
},{"./lib/Dispatcher":4}],4:[function(_dereq_,module,exports){
/*
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Dispatcher
* @typechecks
*/
"use strict";
var invariant = _dereq_('./invariant');
var _lastID = 1;
var _prefix = 'ID_';
/**
* Dispatcher is used to broadcast payloads to registered callbacks. This is
* different from generic pub-sub systems in two ways:
*
* 1) Callbacks are not subscribed to particular events. Every payload is
* dispatched to every registered callback.
* 2) Callbacks can be deferred in whole or part until other callbacks have
* been executed.
*
* For example, consider this hypothetical flight destination form, which
* selects a default city when a country is selected:
*
* var flightDispatcher = new Dispatcher();
*
* // Keeps track of which country is selected
* var CountryStore = {country: null};
*
* // Keeps track of which city is selected
* var CityStore = {city: null};
*
* // Keeps track of the base flight price of the selected city
* var FlightPriceStore = {price: null}
*
* When a user changes the selected city, we dispatch the payload:
*
* flightDispatcher.dispatch({
* actionType: 'city-update',
* selectedCity: 'paris'
* });
*
* This payload is digested by `CityStore`:
*
* flightDispatcher.register(function(payload) {
* if (payload.actionType === 'city-update') {
* CityStore.city = payload.selectedCity;
* }
* });
*
* When the user selects a country, we dispatch the payload:
*
* flightDispatcher.dispatch({
* actionType: 'country-update',
* selectedCountry: 'australia'
* });
*
* This payload is digested by both stores:
*
* CountryStore.dispatchToken = flightDispatcher.register(function(payload) {
* if (payload.actionType === 'country-update') {
* CountryStore.country = payload.selectedCountry;
* }
* });
*
* When the callback to update `CountryStore` is registered, we save a reference
* to the returned token. Using this token with `waitFor()`, we can guarantee
* that `CountryStore` is updated before the callback that updates `CityStore`
* needs to query its data.
*
* CityStore.dispatchToken = flightDispatcher.register(function(payload) {
* if (payload.actionType === 'country-update') {
* // `CountryStore.country` may not be updated.
* flightDispatcher.waitFor([CountryStore.dispatchToken]);
* // `CountryStore.country` is now guaranteed to be updated.
*
* // Select the default city for the new country
* CityStore.city = getDefaultCityForCountry(CountryStore.country);
* }
* });
*
* The usage of `waitFor()` can be chained, for example:
*
* FlightPriceStore.dispatchToken =
* flightDispatcher.register(function(payload) {
* switch (payload.actionType) {
* case 'country-update':
* flightDispatcher.waitFor([CityStore.dispatchToken]);
* FlightPriceStore.price =
* getFlightPriceStore(CountryStore.country, CityStore.city);
* break;
*
* case 'city-update':
* FlightPriceStore.price =
* FlightPriceStore(CountryStore.country, CityStore.city);
* break;
* }
* });
*
* The `country-update` payload will be guaranteed to invoke the stores'
* registered callbacks in order: `CountryStore`, `CityStore`, then
* `FlightPriceStore`.
*/
function Dispatcher() {
this.$Dispatcher_callbacks = {};
this.$Dispatcher_isPending = {};
this.$Dispatcher_isHandled = {};
this.$Dispatcher_isDispatching = false;
this.$Dispatcher_pendingPayload = null;
}
/**
* Registers a callback to be invoked with every dispatched payload. Returns
* a token that can be used with `waitFor()`.
*
* @param {function} callback
* @return {string}
*/
Dispatcher.prototype.register=function(callback) {
var id = _prefix + _lastID++;
this.$Dispatcher_callbacks[id] = callback;
return id;
};
/**
* Removes a callback based on its token.
*
* @param {string} id
*/
Dispatcher.prototype.unregister=function(id) {
invariant(
this.$Dispatcher_callbacks[id],
'Dispatcher.unregister(...): `%s` does not map to a registered callback.',
id
);
delete this.$Dispatcher_callbacks[id];
};
/**
* Waits for the callbacks specified to be invoked before continuing execution
* of the current callback. This method should only be used by a callback in
* response to a dispatched payload.
*
* @param {array<string>} ids
*/
Dispatcher.prototype.waitFor=function(ids) {
invariant(
this.$Dispatcher_isDispatching,
'Dispatcher.waitFor(...): Must be invoked while dispatching.'
);
for (var ii = 0; ii < ids.length; ii++) {
var id = ids[ii];
if (this.$Dispatcher_isPending[id]) {
invariant(
this.$Dispatcher_isHandled[id],
'Dispatcher.waitFor(...): Circular dependency detected while ' +
'waiting for `%s`.',
id
);
continue;
}
invariant(
this.$Dispatcher_callbacks[id],
'Dispatcher.waitFor(...): `%s` does not map to a registered callback.',
id
);
this.$Dispatcher_invokeCallback(id);
}
};
/**
* Dispatches a payload to all registered callbacks.
*
* @param {object} payload
*/
Dispatcher.prototype.dispatch=function(payload) {
invariant(
!this.$Dispatcher_isDispatching,
'Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.'
);
this.$Dispatcher_startDispatching(payload);
try {
for (var id in this.$Dispatcher_callbacks) {
if (this.$Dispatcher_isPending[id]) {
continue;
}
this.$Dispatcher_invokeCallback(id);
}
} finally {
this.$Dispatcher_stopDispatching();
}
};
/**
* Is this Dispatcher currently dispatching.
*
* @return {boolean}
*/
Dispatcher.prototype.isDispatching=function() {
return this.$Dispatcher_isDispatching;
};
/**
* Call the callback stored with the given id. Also do some internal
* bookkeeping.
*
* @param {string} id
* @internal
*/
Dispatcher.prototype.$Dispatcher_invokeCallback=function(id) {
this.$Dispatcher_isPending[id] = true;
this.$Dispatcher_callbacks[id](this.$Dispatcher_pendingPayload);
this.$Dispatcher_isHandled[id] = true;
};
/**
* Set up bookkeeping needed when dispatching.
*
* @param {object} payload
* @internal
*/
Dispatcher.prototype.$Dispatcher_startDispatching=function(payload) {
for (var id in this.$Dispatcher_callbacks) {
this.$Dispatcher_isPending[id] = false;
this.$Dispatcher_isHandled[id] = false;
}
this.$Dispatcher_pendingPayload = payload;
this.$Dispatcher_isDispatching = true;
};
/**
* Clear bookkeeping used for dispatching.
*
* @internal
*/
Dispatcher.prototype.$Dispatcher_stopDispatching=function() {
this.$Dispatcher_pendingPayload = null;
this.$Dispatcher_isDispatching = false;
};
module.exports = Dispatcher;
},{"./invariant":5}],5:[function(_dereq_,module,exports){
/**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule invariant
*/
"use strict";
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var invariant = function(condition, format, a, b, c, d, e, f) {
if (false) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
}
if (!condition) {
var error;
if (format === undefined) {
error = new Error(
'Minified exception occurred; use the non-minified dev environment ' +
'for the full error message and additional helpful warnings.'
);
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(
'Invariant Violation: ' +
format.replace(/%s/g, function() { return args[argIndex++]; })
);
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
};
module.exports = invariant;
},{}],6:[function(_dereq_,module,exports){
'use strict';
function ToObject(val) {
if (val == null) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
module.exports = Object.assign || function (target, source) {
var from;
var keys;
var to = ToObject(target);
for (var s = 1; s < arguments.length; s++) {
from = arguments[s];
keys = Object.keys(Object(from));
for (var i = 0; i < keys.length; i++) {
to[keys[i]] = from[keys[i]];
}
}
return to;
};
},{}],7:[function(_dereq_,module,exports){
"use strict";
/* istanbul ignore next */
(function () {
"use strict";
if (typeof Symbol === "function") {
return module.exports = Symbol;
}
var created = Object.create(null);
var generateName = function (desc) {
var postfix = 0;
while (created[desc + (postfix || "")]) {
++postfix;
}
desc += (postfix || "");
created[desc] = true;
return "@@" + desc;
};
var def = function (value) {
return {
value: value,
configurable: false,
writable: false,
enumerable: false
};
};
var SymbolPolyfill = function (description) {
if (this instanceof SymbolPolyfill) {
throw new TypeError("TypeError: Symbol is not a constructor");
}
var symbol = Object.create(SymbolPolyfill.prototype);
description = (description === undefined ? "" : String(description));
return Object.defineProperties(symbol, {
__description__: def(description),
__name__: def(generateName(description))
});
};
Object.defineProperties(SymbolPolyfill, {
create: def(SymbolPolyfill("create")),
hasInstance: def(SymbolPolyfill("hasInstance")),
isConcatSpreadable: def(SymbolPolyfill("isConcatSpreadable")),
isRegExp: def(SymbolPolyfill("isRegExp")),
iterator: def(SymbolPolyfill("iterator")),
toPrimitive: def(SymbolPolyfill("toPrimitive")),
toStringTag: def(SymbolPolyfill("toStringTag")),
unscopables: def(SymbolPolyfill("unscopables"))
});
Object.defineProperties(SymbolPolyfill.prototype, {
properToString: def(function () {
return "Symbol (" + this.__description__ + ")";
}),
toString: def(function () {
return this.__name__;
})
});
Object.defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, def(function (hint) {
throw new TypeError("Conversion of symbol objects is not allowed");
}));
Object.defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, {
value: "Symbol",
configurable: true,
writable: false,
enumerable: false
});
module.exports = SymbolPolyfill;
}());
},{}]},{},[1])(1)
});

14

package.json
{
"name": "alt",
"version": "0.10.2",
"version": "0.11.0",
"description": "A flux implementation",
"main": "dist/alt.js",
"dependencies": {
"es-symbol": "^1.0.1",
"eventemitter3": "^0.1.6",

@@ -12,6 +13,5 @@ "flux": "^2.0.1",

"devDependencies": {
"6to5": "^1.15.0",
"6to5": "^3.3.12",
"coveralls": "^2.11.2",
"istanbul": "^0.3.5",
"sixpack": "2.0.0"
"istanbul": "^0.3.5"
},

@@ -23,6 +23,6 @@ "repository": {

"scripts": {
"build": "sixpack ./src/alt.js Alt > dist/alt.js",
"build": "6to5 ./src/alt.js > dist/alt.js",
"prepublish": "npm run build",
"coverage": "6to5 src/alt.js > src/coverage-alt.js; 6to5 test.js > coverage-test.js; istanbul cover coverage-test.js",
"test": "6to5 src/alt.js > src/coverage-alt.js; 6to5-node test.js;"
"coverage": "npm test; 6to5 --runtime test.js > coverage-test.js; istanbul cover coverage-test.js",
"test": "6to5 --runtime src/alt.js > src/coverage-alt.js; 6to5-node test.js;"
},

@@ -29,0 +29,0 @@ "keywords": [

@@ -0,1 +1,3 @@

require('6to5/runtime')
var Alt = require('./src/coverage-alt')

@@ -2,0 +4,0 @@ var assert = require('assert')

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