UNPKG

767 BJavaScriptView Raw
1/**
2 * Define apeman store
3 * @function define
4 * @returns Store
5 */
6"use strict";
7
8const Apemanstore = require('./apemanstore');
9
10/** @lends define */
11function define(reducer, properies) {
12 function Store(config) {
13 let s = this;
14 s.__proto__ = new Apemanstore(reducer, config);
15 Object.assign(s, Store.prototype, config);
16 }
17
18 Store.prototype = properies || {};
19
20 Store.singleton = new Store();
21 Store.assign = function assign(config) {
22 let Store = this;
23 Array.prototype.slice.call(arguments, 0).forEach(config => {
24 Object.assign(Store.prototype || {}, config);
25 Object.assign(Store.singleton, config);
26 });
27 return Store;
28 };
29 return Store;
30}
31
32module.exports = define;