1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | "use strict";
|
7 |
|
8 | const Apemanstore = require('./apemanstore');
|
9 |
|
10 |
|
11 | function 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 |
|
32 | module.exports = define;
|