UNPKG

2.58 kBHTMLView Raw
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
5 <title>JSDoc: Source: jsframework/core/data/data.js</title>
6
7 <script src="scripts/prettify/prettify.js"> </script>
8 <script src="scripts/prettify/lang-css.js"> </script>
9 <!--[if lt IE 9]>
10 <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11 <![endif]-->
12 <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13 <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14</head>
15
16<body>
17
18<div id="main">
19
20 <h1 class="page-title">Source: jsframework/core/data/data.js</h1>
21
22
23
24
25
26
27 <section>
28 <article>
29 <pre class="prettyprint source linenums"><code>/**
30 * Created by zhangmike on 16/10/18.
31 */
32export default class GMPX {
33 constructor(state) {
34 this._init(state);
35 }
36 _init(state) {
37 if (!state) {
38 return Object.create(null);
39 }
40 var keys = Object.keys(state);
41 this.state = state;
42 var that = this;
43 for (var i = 0, l = keys.length; i &lt; l; i++) {
44 var key = keys[i],
45 val = this.state[keys[i]];
46 var property = Object.getOwnPropertyDescriptor(this.state, key);
47 if (property &amp;&amp; property.configurable === false) {
48 continue;
49 }
50
51 (function(k, v) {
52 Object.defineProperty(that.state, k, {
53 enumerable: true,
54 configurable: true,
55 get: function reactiveGetter() {
56 return v;
57 },
58 set: function reactiveSetter(newVal) {
59 var value = v;
60 if (newVal === value) {
61 return;
62 }
63 v = newVal;
64 }
65 });
66 })(key, val);
67 }
68 }
69}
70</code></pre>
71 </article>
72 </section>
73
74
75
76
77</div>
78
79<nav>
80 <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="global.html#GMP">GMP</a></li><li><a href="module.html#.exports">exports</a></li></ul><h3>Global</h3><ul><li><a href="global.html#isType">isType</a></li><li><a href="global.html#uid">uid</a></li></ul>
81</nav>
82
83<br class="clear">
84
85<footer>
86 Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Mon Oct 24 2016 18:10:18 GMT+0800 (CST)
87</footer>
88
89<script> prettyPrint(); </script>
90<script src="scripts/linenumber.js"> </script>
91</body>
92</html>