1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | 'use strict';
|
13 |
|
14 |
|
15 |
|
16 | var REACT_COROUTINE_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.coroutine') || 0xeac8;
|
17 |
|
18 | var REACT_YIELD_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.yield') || 0xeac9;
|
19 |
|
20 | exports.createCoroutine = function (children, handler, props) {
|
21 | var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
22 |
|
23 | var coroutine = {
|
24 |
|
25 | $$typeof: REACT_COROUTINE_TYPE,
|
26 | key: key == null ? null : '' + key,
|
27 | children: children,
|
28 | handler: handler,
|
29 | props: props
|
30 | };
|
31 |
|
32 | if (process.env.NODE_ENV !== 'production') {
|
33 |
|
34 | if (Object.freeze) {
|
35 | Object.freeze(coroutine.props);
|
36 | Object.freeze(coroutine);
|
37 | }
|
38 | }
|
39 |
|
40 | return coroutine;
|
41 | };
|
42 |
|
43 | exports.createYield = function (props, continuation) {
|
44 | var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
45 |
|
46 | var yieldNode = {
|
47 |
|
48 | $$typeof: REACT_YIELD_TYPE,
|
49 | key: key == null ? null : '' + key,
|
50 | props: props,
|
51 | continuation: continuation
|
52 | };
|
53 |
|
54 | if (process.env.NODE_ENV !== 'production') {
|
55 |
|
56 | if (Object.freeze) {
|
57 | Object.freeze(yieldNode.props);
|
58 | Object.freeze(yieldNode);
|
59 | }
|
60 | }
|
61 |
|
62 | return yieldNode;
|
63 | };
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | exports.isCoroutine = function (object) {
|
69 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_COROUTINE_TYPE;
|
70 | };
|
71 |
|
72 |
|
73 |
|
74 |
|
75 | exports.isYield = function (object) {
|
76 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_YIELD_TYPE;
|
77 | };
|
78 |
|
79 | exports.REACT_YIELD_TYPE = REACT_YIELD_TYPE;
|
80 | exports.REACT_COROUTINE_TYPE = REACT_COROUTINE_TYPE; |
\ | No newline at end of file |