electron-event-flux
Advanced tools
Comparing version 0.6.1 to 0.6.2
@@ -7,8 +7,2 @@ 'use strict'; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
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; } | ||
@@ -112,13 +106,14 @@ | ||
function extendClass(StoreClass) { | ||
return function (_StoreClass) { | ||
_inherits(ExtendStoreClass, _StoreClass); | ||
// return class ExtendStoreClass extends StoreClass {}; | ||
function ExtendStoreClass() { | ||
var obj = new StoreClass(); | ||
Object.setPrototypeOf(obj, new.target.prototype); | ||
// or B.prototype, but if you derive from B you'll have to do this dance again | ||
function ExtendStoreClass() { | ||
_classCallCheck(this, ExtendStoreClass); | ||
return _possibleConstructorReturn(this, (ExtendStoreClass.__proto__ || Object.getPrototypeOf(ExtendStoreClass)).apply(this, arguments)); | ||
} | ||
return ExtendStoreClass; | ||
}(StoreClass); | ||
// use obj instead of this | ||
return obj; | ||
} | ||
Object.setPrototypeOf(ExtendStoreClass.prototype, StoreClass.prototype); | ||
Object.setPrototypeOf(ExtendStoreClass, StoreClass); | ||
return ExtendStoreClass; | ||
} | ||
@@ -172,3 +167,3 @@ | ||
StoreClass.prototype.buildStores = function () { | ||
var _this5 = this; | ||
var _this4 = this; | ||
@@ -183,4 +178,4 @@ subStoreInfos.forEach(function (_ref) { | ||
storeBuilders[type].call(_this5, StoreClass, storeKey, stateKey, options); | ||
var store = _this5.getStore ? _this5.getStore(storeKey) : _this5[storeKey]; | ||
storeBuilders[type].call(_this4, StoreClass, storeKey, stateKey, options); | ||
var store = _this4.getStore ? _this4.getStore(storeKey) : _this4[storeKey]; | ||
store.buildStores && store.buildStores(); | ||
@@ -190,7 +185,7 @@ }); | ||
StoreClass.prototype.initStores = function () { | ||
var _this6 = this; | ||
var _this5 = this; | ||
subStoreInfos.forEach(function (info) { | ||
var storeKey = info[2]; | ||
var store = _this6.getStore ? _this6.getStore(storeKey) : _this6[storeKey]; | ||
var store = _this5.getStore ? _this5.getStore(storeKey) : _this5[storeKey]; | ||
@@ -202,3 +197,3 @@ store.initStores && store.initStores(); | ||
StoreClass.prototype.startObserve = function () { | ||
var _this7 = this; | ||
var _this6 = this; | ||
@@ -213,14 +208,14 @@ subStoreInfos.forEach(function (_ref3) { | ||
var store = _this7.getStore ? _this7.getStore(storeKey) : _this7[storeKey]; | ||
var store = _this6.getStore ? _this6.getStore(storeKey) : _this6[storeKey]; | ||
console.log('in observe:', storeKey, stateKey); | ||
store.startObserve && store.startObserve(); | ||
storeObservers[type].call(_this7, storeKey, stateKey, options); | ||
storeObservers[type].call(_this6, storeKey, stateKey, options); | ||
}); | ||
}; | ||
StoreClass.prototype.disposeStores = function () { | ||
var _this8 = this; | ||
var _this7 = this; | ||
subStoreInfos.forEach(function (info) { | ||
var storeKey = info[2]; | ||
var store = _this8.getStore ? _this8.getStore(storeKey) : _this8[storeKey]; | ||
var store = _this7.getStore ? _this7.getStore(storeKey) : _this7[storeKey]; | ||
if (store) { | ||
@@ -227,0 +222,0 @@ store.disposeStores && store.disposeStores(); |
{ | ||
"name": "electron-event-flux", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"description": "Redux store which synchronizes between instances in multiple process", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -84,3 +84,14 @@ /* | ||
function extendClass(StoreClass) { | ||
return class ExtendStoreClass extends StoreClass {}; | ||
// return class ExtendStoreClass extends StoreClass {}; | ||
function ExtendStoreClass() { | ||
const obj = new StoreClass(); | ||
Object.setPrototypeOf(obj, new.target.prototype); | ||
// or B.prototype, but if you derive from B you'll have to do this dance again | ||
// use obj instead of this | ||
return obj; | ||
} | ||
Object.setPrototypeOf(ExtendStoreClass.prototype, StoreClass.prototype); | ||
Object.setPrototypeOf(ExtendStoreClass, StoreClass); | ||
return ExtendStoreClass; | ||
} | ||
@@ -87,0 +98,0 @@ |
2869
133409