1 | (function webpackUniversalModuleDefinition(root, factory) {
|
2 | if(typeof exports === 'object' && typeof module === 'object')
|
3 | module.exports = factory();
|
4 | else if(typeof define === 'function' && define.amd)
|
5 | define(factory);
|
6 | else if(typeof exports === 'object')
|
7 | exports["ReactHotAPI"] = factory();
|
8 | else
|
9 | root["ReactHotAPI"] = factory();
|
10 | })(this, function() {
|
11 | return (function(modules) {
|
12 |
|
13 | var installedModules = {};
|
14 |
|
15 |
|
16 | function __webpack_require__(moduleId) {
|
17 |
|
18 |
|
19 | if(installedModules[moduleId])
|
20 | return installedModules[moduleId].exports;
|
21 |
|
22 |
|
23 | var module = installedModules[moduleId] = {
|
24 | exports: {},
|
25 | id: moduleId,
|
26 | loaded: false
|
27 | };
|
28 |
|
29 |
|
30 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31 |
|
32 |
|
33 | module.loaded = true;
|
34 |
|
35 |
|
36 | return module.exports;
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 | __webpack_require__.m = modules;
|
42 |
|
43 |
|
44 | __webpack_require__.c = installedModules;
|
45 |
|
46 |
|
47 | __webpack_require__.p = "";
|
48 |
|
49 |
|
50 | return __webpack_require__(0);
|
51 | })
|
52 |
|
53 | ([
|
54 |
|
55 | function(module, exports, __webpack_require__) {
|
56 |
|
57 | 'use strict';
|
58 |
|
59 | module.exports = __webpack_require__(4);
|
60 |
|
61 | },
|
62 |
|
63 | function(module, exports, __webpack_require__) {
|
64 |
|
65 | 'use strict';
|
66 |
|
67 | |
68 |
|
69 |
|
70 | function bindAutoBindMethod(component, method) {
|
71 | var boundMethod = method.bind(component);
|
72 |
|
73 | boundMethod.__reactBoundContext = component;
|
74 | boundMethod.__reactBoundMethod = method;
|
75 | boundMethod.__reactBoundArguments = null;
|
76 |
|
77 | var componentName = component.constructor.displayName,
|
78 | _bind = boundMethod.bind;
|
79 |
|
80 | boundMethod.bind = function (newThis) {
|
81 | var args = Array.prototype.slice.call(arguments, 1);
|
82 | if (newThis !== component && newThis !== null) {
|
83 | console.warn(
|
84 | 'bind(): React component methods may only be bound to the ' +
|
85 | 'component instance. See ' + componentName
|
86 | );
|
87 | } else if (!args.length) {
|
88 | console.warn(
|
89 | 'bind(): You are binding a component method to the component. ' +
|
90 | 'React does this for you automatically in a high-performance ' +
|
91 | 'way, so you can safely remove this call. See ' + componentName
|
92 | );
|
93 | return boundMethod;
|
94 | }
|
95 |
|
96 | var reboundMethod = _bind.apply(boundMethod, arguments);
|
97 | reboundMethod.__reactBoundContext = component;
|
98 | reboundMethod.__reactBoundMethod = method;
|
99 | reboundMethod.__reactBoundArguments = args;
|
100 |
|
101 | return reboundMethod;
|
102 | };
|
103 |
|
104 | return boundMethod;
|
105 | }
|
106 |
|
107 | |
108 |
|
109 |
|
110 |
|
111 |
|
112 | module.exports = function bindAutoBindMethods(component) {
|
113 | for (var autoBindKey in component.__reactAutoBindMap) {
|
114 | if (!component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
|
115 | continue;
|
116 | }
|
117 |
|
118 |
|
119 | if (component.hasOwnProperty(autoBindKey) &&
|
120 | component[autoBindKey].__reactBoundContext === component) {
|
121 | continue;
|
122 | }
|
123 |
|
124 | var method = component.__reactAutoBindMap[autoBindKey];
|
125 | component[autoBindKey] = bindAutoBindMethod(component, method);
|
126 | }
|
127 | };
|
128 |
|
129 | },
|
130 |
|
131 | function(module, exports, __webpack_require__) {
|
132 |
|
133 | 'use strict';
|
134 |
|
135 | var bindAutoBindMethods = __webpack_require__(1);
|
136 |
|
137 | |
138 |
|
139 |
|
140 |
|
141 |
|
142 | function deepForceUpdate(component) {
|
143 | if (component._instance) {
|
144 |
|
145 | component = component._instance;
|
146 | }
|
147 |
|
148 | bindAutoBindMethods(component);
|
149 |
|
150 | if (component.forceUpdate) {
|
151 | component.forceUpdate();
|
152 | }
|
153 |
|
154 | if (component._renderedComponent) {
|
155 | deepForceUpdate(component._renderedComponent);
|
156 | }
|
157 |
|
158 | for (var key in component._renderedChildren) {
|
159 | deepForceUpdate(component._renderedChildren[key]);
|
160 | }
|
161 | }
|
162 |
|
163 | module.exports = deepForceUpdate;
|
164 |
|
165 | },
|
166 |
|
167 | function(module, exports, __webpack_require__) {
|
168 |
|
169 | 'use strict';
|
170 |
|
171 | |
172 |
|
173 |
|
174 |
|
175 |
|
176 | module.exports = function makeAssimilatePrototype() {
|
177 | var storedPrototype,
|
178 | knownPrototypes = [];
|
179 |
|
180 | function wrapMethod(key) {
|
181 | return function () {
|
182 | if (storedPrototype[key]) {
|
183 | return storedPrototype[key].apply(this, arguments);
|
184 | }
|
185 | };
|
186 | }
|
187 |
|
188 | function patchProperty(proto, key) {
|
189 | proto[key] = storedPrototype[key];
|
190 |
|
191 | if (typeof proto[key] !== 'function' ||
|
192 | key === 'type' ||
|
193 | key === 'constructor') {
|
194 | return;
|
195 | }
|
196 |
|
197 | proto[key] = wrapMethod(key);
|
198 |
|
199 | if (storedPrototype[key].isReactClassApproved) {
|
200 | proto[key].isReactClassApproved = storedPrototype[key].isReactClassApproved;
|
201 | }
|
202 |
|
203 | if (proto.__reactAutoBindMap && proto.__reactAutoBindMap[key]) {
|
204 | proto.__reactAutoBindMap[key] = proto[key];
|
205 | }
|
206 | }
|
207 |
|
208 | function updateStoredPrototype(freshPrototype) {
|
209 | storedPrototype = {};
|
210 |
|
211 | for (var key in freshPrototype) {
|
212 | if (freshPrototype.hasOwnProperty(key)) {
|
213 | storedPrototype[key] = freshPrototype[key];
|
214 | }
|
215 | }
|
216 | }
|
217 |
|
218 | function reconcileWithStoredPrototypes(freshPrototype) {
|
219 | knownPrototypes.push(freshPrototype);
|
220 | knownPrototypes.forEach(function (proto) {
|
221 | for (var key in storedPrototype) {
|
222 | patchProperty(proto, key);
|
223 | }
|
224 | });
|
225 | }
|
226 |
|
227 | return function assimilatePrototype(freshPrototype) {
|
228 | if (freshPrototype.__isAssimilatedByReactHotAPI) {
|
229 | return;
|
230 | }
|
231 |
|
232 | updateStoredPrototype(freshPrototype);
|
233 | reconcileWithStoredPrototypes(freshPrototype);
|
234 | freshPrototype.__isAssimilatedByReactHotAPI = true;
|
235 | };
|
236 | };
|
237 |
|
238 | },
|
239 |
|
240 | function(module, exports, __webpack_require__) {
|
241 |
|
242 | 'use strict';
|
243 |
|
244 | var makePatchReactClass = __webpack_require__(5);
|
245 |
|
246 | |
247 |
|
248 |
|
249 |
|
250 | module.exports = function makeMakeHot(getRootInstances) {
|
251 | if (typeof getRootInstances !== 'function') {
|
252 | throw new Error('Expected getRootInstances to be a function.');
|
253 | }
|
254 |
|
255 | var patchers = {};
|
256 |
|
257 | return function makeHot(NextClass, persistentId) {
|
258 | persistentId = persistentId || NextClass.displayName || NextClass.name;
|
259 |
|
260 | if (!persistentId) {
|
261 | console.error(
|
262 | 'Hot reload is disabled for one of your types. To enable it, pass a ' +
|
263 | 'string uniquely identifying this class within this current module ' +
|
264 | 'as a second parameter to makeHot.'
|
265 | );
|
266 | return NextClass;
|
267 | }
|
268 |
|
269 | if (!patchers[persistentId]) {
|
270 | patchers[persistentId] = makePatchReactClass(getRootInstances);
|
271 | }
|
272 |
|
273 | var patchReactClass = patchers[persistentId];
|
274 | return patchReactClass(NextClass);
|
275 | };
|
276 | };
|
277 |
|
278 | },
|
279 |
|
280 | function(module, exports, __webpack_require__) {
|
281 |
|
282 | 'use strict';
|
283 |
|
284 | var makeAssimilatePrototype = __webpack_require__(3),
|
285 | requestForceUpdateAll = __webpack_require__(6);
|
286 |
|
287 | function hasLegacyTypeProperty(ReactClass) {
|
288 | if (!ReactClass.hasOwnProperty('type')) {
|
289 | return false;
|
290 | }
|
291 |
|
292 | var descriptor = Object.getOwnPropertyDescriptor(ReactClass, 'type');
|
293 | if (typeof descriptor.get === 'function') {
|
294 | return false;
|
295 | }
|
296 |
|
297 | return true;
|
298 | }
|
299 |
|
300 | function getPrototype(ReactClass) {
|
301 | var prototype = ReactClass.prototype;
|
302 |
|
303 | if (typeof prototype.render !== 'function' && hasLegacyTypeProperty(ReactClass)) {
|
304 | prototype = ReactClass.type.prototype;
|
305 | }
|
306 |
|
307 | return prototype;
|
308 | }
|
309 |
|
310 | |
311 |
|
312 |
|
313 |
|
314 | module.exports = function makePatchReactClass(getRootInstances) {
|
315 | var assimilatePrototype = makeAssimilatePrototype(),
|
316 | FirstClass = null;
|
317 |
|
318 | return function patchReactClass(NextClass) {
|
319 | var nextPrototype = getPrototype(NextClass);
|
320 | assimilatePrototype(nextPrototype);
|
321 |
|
322 | if (FirstClass) {
|
323 | requestForceUpdateAll(getRootInstances);
|
324 | }
|
325 |
|
326 | return FirstClass || (FirstClass = NextClass);
|
327 | };
|
328 | };
|
329 |
|
330 | },
|
331 |
|
332 | function(module, exports, __webpack_require__) {
|
333 |
|
334 | var deepForceUpdate = __webpack_require__(2);
|
335 |
|
336 | var isRequestPending = false;
|
337 |
|
338 | module.exports = function requestForceUpdateAll(getRootInstances) {
|
339 | if (isRequestPending) {
|
340 | return;
|
341 | }
|
342 |
|
343 | |
344 |
|
345 |
|
346 |
|
347 |
|
348 | function forceUpdateAll() {
|
349 | isRequestPending = false;
|
350 |
|
351 | var rootInstances = getRootInstances(),
|
352 | rootInstance;
|
353 |
|
354 | for (var key in rootInstances) {
|
355 | if (rootInstances.hasOwnProperty(key)) {
|
356 | deepForceUpdate(rootInstances[key]);
|
357 | }
|
358 | }
|
359 | }
|
360 |
|
361 | setTimeout(forceUpdateAll);
|
362 | };
|
363 |
|
364 | }
|
365 | ])
|
366 | });
|