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

@filerobot/store-default

Package Overview
Dependencies
Maintainers
2
Versions
729
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@filerobot/store-default - npm Package Compare versions

Comparing version 1.0.21 to 1.0.22

75

lib/index.js
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"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/**

@@ -8,2 +16,4 @@ * Default store that keeps state in a simple object.

function DefaultStore() {
_classCallCheck(this, DefaultStore);
this.state = {};

@@ -13,44 +23,49 @@ this.callbacks = [];

var _proto = DefaultStore.prototype;
_createClass(DefaultStore, [{
key: "getState",
value: function getState() {
return this.state;
}
}, {
key: "setState",
value: function setState(patch) {
var prevState = _extends({}, this.state);
_proto.getState = function getState() {
return this.state;
};
var nextState = _extends({}, this.state, patch);
_proto.setState = function setState(patch) {
var prevState = _extends({}, this.state);
this.state = nextState;
var nextState = _extends({}, this.state, patch);
this._publish(prevState, nextState, patch);
}
}, {
key: "subscribe",
value: function subscribe(listener) {
var _this = this;
this.state = nextState;
this.callbacks.push(listener);
return function () {
// Remove the listener.
_this.callbacks.splice(_this.callbacks.indexOf(listener), 1);
};
}
}, {
key: "_publish",
value: function _publish() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
this._publish(prevState, nextState, patch);
};
_proto.subscribe = function subscribe(listener) {
var _this = this;
this.callbacks.push(listener);
return function () {
// Remove the listener.
_this.callbacks.splice(_this.callbacks.indexOf(listener), 1);
};
};
_proto._publish = function _publish() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
this.callbacks.forEach(function (listener) {
listener.apply(void 0, args);
});
}
}]);
this.callbacks.forEach(function (listener) {
listener.apply(void 0, args);
});
};
return DefaultStore;
}();
DefaultStore.VERSION = require('../package.json').version;
_defineProperty(DefaultStore, "VERSION", require('../package.json').version);
export default function defaultStore() {
return new DefaultStore();
}

2

package.json
{
"name": "@filerobot/store-default",
"description": "The default simple object-based store for Filerobot Media Asset Widget.",
"version": "1.0.21",
"version": "1.0.22",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "lib/index.js",

# `@filerobot/store-default`
A simple store plugin used to store & handle the state of the Filerobot widget and keeps the data.

@@ -0,0 +0,0 @@ import FilerobotUtils = require('@filerobot/utils')

@@ -0,0 +0,0 @@ import DefaultStore = require('../')

Sorry, the diff of this file is not supported yet

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