d416a29d6bf790d9b4bf9f0a36a8d3d0.json 2.94 KB
{"ast":null,"code":"import * as React from 'react';\nimport raf from \"rc-util/es/raf\";\nexport default (function () {\n  var nextFrameRef = React.useRef(null);\n\n  function cancelNextFrame() {\n    raf.cancel(nextFrameRef.current);\n  }\n\n  function nextFrame(callback) {\n    var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;\n    cancelNextFrame();\n    var nextFrameId = raf(function () {\n      if (delay <= 1) {\n        callback({\n          isCanceled: function isCanceled() {\n            return nextFrameId !== nextFrameRef.current;\n          }\n        });\n      } else {\n        nextFrame(callback, delay - 1);\n      }\n    });\n    nextFrameRef.current = nextFrameId;\n  }\n\n  React.useEffect(function () {\n    return function () {\n      cancelNextFrame();\n    };\n  }, []);\n  return [nextFrame, cancelNextFrame];\n});","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-motion/es/hooks/useNextFrame.js"],"names":["React","raf","nextFrameRef","useRef","cancelNextFrame","cancel","current","nextFrame","callback","delay","arguments","length","undefined","nextFrameId","isCanceled","useEffect"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,gBAAgB,YAAY;AAC1B,MAAIC,YAAY,GAAGF,KAAK,CAACG,MAAN,CAAa,IAAb,CAAnB;;AAEA,WAASC,eAAT,GAA2B;AACzBH,IAAAA,GAAG,CAACI,MAAJ,CAAWH,YAAY,CAACI,OAAxB;AACD;;AAED,WAASC,SAAT,CAAmBC,QAAnB,EAA6B;AAC3B,QAAIC,KAAK,GAAGC,SAAS,CAACC,MAAV,GAAmB,CAAnB,IAAwBD,SAAS,CAAC,CAAD,CAAT,KAAiBE,SAAzC,GAAqDF,SAAS,CAAC,CAAD,CAA9D,GAAoE,CAAhF;AACAN,IAAAA,eAAe;AACf,QAAIS,WAAW,GAAGZ,GAAG,CAAC,YAAY;AAChC,UAAIQ,KAAK,IAAI,CAAb,EAAgB;AACdD,QAAAA,QAAQ,CAAC;AACPM,UAAAA,UAAU,EAAE,SAASA,UAAT,GAAsB;AAChC,mBAAOD,WAAW,KAAKX,YAAY,CAACI,OAApC;AACD;AAHM,SAAD,CAAR;AAKD,OAND,MAMO;AACLC,QAAAA,SAAS,CAACC,QAAD,EAAWC,KAAK,GAAG,CAAnB,CAAT;AACD;AACF,KAVoB,CAArB;AAWAP,IAAAA,YAAY,CAACI,OAAb,GAAuBO,WAAvB;AACD;;AAEDb,EAAAA,KAAK,CAACe,SAAN,CAAgB,YAAY;AAC1B,WAAO,YAAY;AACjBX,MAAAA,eAAe;AAChB,KAFD;AAGD,GAJD,EAIG,EAJH;AAKA,SAAO,CAACG,SAAD,EAAYH,eAAZ,CAAP;AACD,CA9BD","sourcesContent":["import * as React from 'react';\nimport raf from \"rc-util/es/raf\";\nexport default (function () {\n  var nextFrameRef = React.useRef(null);\n\n  function cancelNextFrame() {\n    raf.cancel(nextFrameRef.current);\n  }\n\n  function nextFrame(callback) {\n    var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;\n    cancelNextFrame();\n    var nextFrameId = raf(function () {\n      if (delay <= 1) {\n        callback({\n          isCanceled: function isCanceled() {\n            return nextFrameId !== nextFrameRef.current;\n          }\n        });\n      } else {\n        nextFrame(callback, delay - 1);\n      }\n    });\n    nextFrameRef.current = nextFrameId;\n  }\n\n  React.useEffect(function () {\n    return function () {\n      cancelNextFrame();\n    };\n  }, []);\n  return [nextFrame, cancelNextFrame];\n});"]},"metadata":{},"sourceType":"module"}