546559806d501d16fc1ea2ed1b524be5.json
4.14 KB
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport raf from \"rc-util/es/raf\";\nexport default function useFrameSetState(initial) {\n var frame = React.useRef(null);\n\n var _React$useState = React.useState(initial),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n state = _React$useState2[0],\n setState = _React$useState2[1];\n\n var queue = React.useRef([]);\n\n var setFrameState = function setFrameState(newState) {\n if (frame.current === null) {\n queue.current = [];\n frame.current = raf(function () {\n setState(function (preState) {\n var memoState = preState;\n queue.current.forEach(function (queueState) {\n memoState = _objectSpread(_objectSpread({}, memoState), queueState);\n });\n frame.current = null;\n return memoState;\n });\n });\n }\n\n queue.current.push(newState);\n };\n\n React.useEffect(function () {\n return function () {\n return frame.current && raf.cancel(frame.current);\n };\n }, []);\n return [state, setFrameState];\n}","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-image/es/hooks/useFrameSetState.js"],"names":["_objectSpread","_slicedToArray","React","raf","useFrameSetState","initial","frame","useRef","_React$useState","useState","_React$useState2","state","setState","queue","setFrameState","newState","current","preState","memoState","forEach","queueState","push","useEffect","cancel"],"mappings":"AAAA,OAAOA,aAAP,MAA0B,0CAA1B;AACA,OAAOC,cAAP,MAA2B,0CAA3B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,eAAe,SAASC,gBAAT,CAA0BC,OAA1B,EAAmC;AAChD,MAAIC,KAAK,GAAGJ,KAAK,CAACK,MAAN,CAAa,IAAb,CAAZ;;AAEA,MAAIC,eAAe,GAAGN,KAAK,CAACO,QAAN,CAAeJ,OAAf,CAAtB;AAAA,MACIK,gBAAgB,GAAGT,cAAc,CAACO,eAAD,EAAkB,CAAlB,CADrC;AAAA,MAEIG,KAAK,GAAGD,gBAAgB,CAAC,CAAD,CAF5B;AAAA,MAGIE,QAAQ,GAAGF,gBAAgB,CAAC,CAAD,CAH/B;;AAKA,MAAIG,KAAK,GAAGX,KAAK,CAACK,MAAN,CAAa,EAAb,CAAZ;;AAEA,MAAIO,aAAa,GAAG,SAASA,aAAT,CAAuBC,QAAvB,EAAiC;AACnD,QAAIT,KAAK,CAACU,OAAN,KAAkB,IAAtB,EAA4B;AAC1BH,MAAAA,KAAK,CAACG,OAAN,GAAgB,EAAhB;AACAV,MAAAA,KAAK,CAACU,OAAN,GAAgBb,GAAG,CAAC,YAAY;AAC9BS,QAAAA,QAAQ,CAAC,UAAUK,QAAV,EAAoB;AAC3B,cAAIC,SAAS,GAAGD,QAAhB;AACAJ,UAAAA,KAAK,CAACG,OAAN,CAAcG,OAAd,CAAsB,UAAUC,UAAV,EAAsB;AAC1CF,YAAAA,SAAS,GAAGlB,aAAa,CAACA,aAAa,CAAC,EAAD,EAAKkB,SAAL,CAAd,EAA+BE,UAA/B,CAAzB;AACD,WAFD;AAGAd,UAAAA,KAAK,CAACU,OAAN,GAAgB,IAAhB;AACA,iBAAOE,SAAP;AACD,SAPO,CAAR;AAQD,OATkB,CAAnB;AAUD;;AAEDL,IAAAA,KAAK,CAACG,OAAN,CAAcK,IAAd,CAAmBN,QAAnB;AACD,GAhBD;;AAkBAb,EAAAA,KAAK,CAACoB,SAAN,CAAgB,YAAY;AAC1B,WAAO,YAAY;AACjB,aAAOhB,KAAK,CAACU,OAAN,IAAiBb,GAAG,CAACoB,MAAJ,CAAWjB,KAAK,CAACU,OAAjB,CAAxB;AACD,KAFD;AAGD,GAJD,EAIG,EAJH;AAKA,SAAO,CAACL,KAAD,EAAQG,aAAR,CAAP;AACD","sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport raf from \"rc-util/es/raf\";\nexport default function useFrameSetState(initial) {\n var frame = React.useRef(null);\n\n var _React$useState = React.useState(initial),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n state = _React$useState2[0],\n setState = _React$useState2[1];\n\n var queue = React.useRef([]);\n\n var setFrameState = function setFrameState(newState) {\n if (frame.current === null) {\n queue.current = [];\n frame.current = raf(function () {\n setState(function (preState) {\n var memoState = preState;\n queue.current.forEach(function (queueState) {\n memoState = _objectSpread(_objectSpread({}, memoState), queueState);\n });\n frame.current = null;\n return memoState;\n });\n });\n }\n\n queue.current.push(newState);\n };\n\n React.useEffect(function () {\n return function () {\n return frame.current && raf.cancel(frame.current);\n };\n }, []);\n return [state, setFrameState];\n}"]},"metadata":{},"sourceType":"module"}