@uppy/store-default
Advanced tools
Comparing version 0.28.3 to 1.1.0
@@ -1,12 +0,10 @@ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
/** | ||
* Default store that keeps state in a simple object. | ||
*/ | ||
var DefaultStore = function () { | ||
var DefaultStore = | ||
/*#__PURE__*/ | ||
function () { | ||
function DefaultStore() { | ||
_classCallCheck(this, DefaultStore); | ||
this.state = {}; | ||
@@ -16,15 +14,19 @@ this.callbacks = []; | ||
DefaultStore.prototype.getState = function getState() { | ||
var _proto = DefaultStore.prototype; | ||
_proto.getState = function getState() { | ||
return this.state; | ||
}; | ||
DefaultStore.prototype.setState = function setState(patch) { | ||
_proto.setState = function setState(patch) { | ||
var prevState = _extends({}, this.state); | ||
var nextState = _extends({}, this.state, patch); | ||
this.state = nextState; | ||
this._publish(prevState, nextState, patch); | ||
}; | ||
DefaultStore.prototype.subscribe = function subscribe(listener) { | ||
_proto.subscribe = function subscribe(listener) { | ||
var _this = this; | ||
@@ -39,4 +41,4 @@ | ||
DefaultStore.prototype._publish = function _publish() { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
_proto._publish = function _publish() { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
@@ -46,3 +48,3 @@ } | ||
this.callbacks.forEach(function (listener) { | ||
listener.apply(undefined, args); | ||
listener.apply(void 0, args); | ||
}); | ||
@@ -54,4 +56,6 @@ }; | ||
DefaultStore.VERSION = "1.1.0"; | ||
module.exports = function defaultStore() { | ||
return new DefaultStore(); | ||
}; |
{ | ||
"name": "@uppy/store-default", | ||
"description": "The default simple object-based store for Uppy.", | ||
"version": "0.28.3", | ||
"version": "1.1.0", | ||
"license": "MIT", | ||
@@ -21,3 +21,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "27899d944f0ffb551d0473955236734c24eb4fff" | ||
"gitHead": "28d235fe2fb57d87a399c20883fd6590aa49f4f4" | ||
} |
@@ -5,2 +5,4 @@ /** | ||
class DefaultStore { | ||
static VERSION = require('../package.json').version | ||
constructor () { | ||
@@ -7,0 +9,0 @@ this.state = {} |
@@ -1,4 +0,4 @@ | ||
import Uppy = require('@uppy/core'); | ||
import UppyUtils = require('@uppy/utils'); | ||
declare class DefaultStore implements Uppy.Store { | ||
declare class DefaultStore implements UppyUtils.Store { | ||
constructor(); | ||
@@ -5,0 +5,0 @@ getState(): object; |
@@ -1,2 +0,1 @@ | ||
import Uppy = require('@uppy/core'); | ||
import DefaultStore = require('../'); | ||
@@ -8,3 +7,1 @@ | ||
store.getState(); | ||
Uppy({ store }); |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
131
0
7042