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