-
Notifications
You must be signed in to change notification settings - Fork 11
/
bundle.es.js
82 lines (73 loc) · 1.75 KB
/
bundle.es.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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;
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
var index = {
props: {
mapDispatchToProps: {
required: false,
default: function _default() {
return {};
},
type: Function
},
mapStateToProps: {
required: false,
default: function _default() {
return {};
},
type: Function
},
store: {
required: true,
type: Object
}
},
data: function data(ctx) {
return {
state: ctx.store.getState()
};
},
created: function created() {
var _this = this;
this.unsubscribe = this.store.subscribe(function () {
_this.state = _this.store.getState();
});
},
destroyed: function destroyed() {
this.unsubscribe();
},
render: function render() {
var nodes = this.$scopedSlots.default(_objectSpread({}, this.mapDispatchToProps(this.store.dispatch), this.mapStateToProps(this.state)));
if (Array.isArray(nodes)) {
return nodes[0];
} else {
return nodes;
}
}
};
export default index;