mirror of
https://github.com/pezkuwichain/pezkuwi-mobile-app.git
synced 2026-05-30 07:41:01 +00:00
1 line
6.8 KiB
Plaintext
1 line
6.8 KiB
Plaintext
{"dependencies":[{"name":"react","data":{"asyncType":null,"isESMImport":true,"locs":[{"start":{"line":2,"column":0,"index":61},"end":{"line":2,"column":52,"index":113}}],"key":"RtGiGa+/H7VrI7GDQDLhO1UbpU8=","exportNames":["*"]}}],"output":[{"data":{"code":"__d(function (global, require, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.useEvent = useEvent;\n exports.useEventListener = useEventListener;\n var _react = require(_dependencyMap[0], \"react\");\n /**\n * Type helper that infers the event name from the emitter's events map.\n */\n\n /**\n * Type helper that infers the event listener from the emitter's events map.\n */\n\n /**\n * Type helper that infers the first parameter of the event listener.\n */\n\n /**\n * React hook that listens to events emitted by the given object. The returned value is an event parameter\n * that gets updated whenever a new event is dispatched.\n * @param eventEmitter An object that emits events. For example, a native module or shared object or an instance of [`EventEmitter`](#eventemitter).\n * @param eventName Name of the event to listen to.\n * @param initialValue An event parameter to use until the event is called for the first time.\n * @returns A parameter of the event listener.\n * @example\n * ```tsx\n * import { useEvent } from 'expo';\n * import { VideoPlayer } from 'expo-video';\n *\n * export function PlayerStatus({ videoPlayer }: { videoPlayer: VideoPlayer }) {\n * const { status } = useEvent(videoPlayer, 'statusChange', { status: videoPlayer.status });\n *\n * return <Text>{`Player status: ${status}`}</Text>;\n * }\n * ```\n */\n function useEvent(eventEmitter, eventName, initialValue = null) {\n const [event, setEvent] = (0, _react.useState)(initialValue);\n const listener = event => setEvent(event);\n useEventListener(eventEmitter, eventName, listener);\n return event;\n }\n\n /**\n * React hook that listens to events emitted by the given object and calls the listener function whenever a new event is dispatched.\n * The event listener is automatically added during the first render and removed when the component unmounts.\n * @param eventEmitter An object that emits events. For example, a native module or shared object or an instance of [`EventEmitter`](#eventemitter).\n * @param eventName Name of the event to listen to.\n * @param listener A function to call when the event is dispatched.\n * @example\n * ```tsx\n * import { useEventListener } from 'expo';\n * import { useVideoPlayer, VideoView } from 'expo-video';\n *\n * export function VideoPlayerView() {\n * const player = useVideoPlayer(videoSource);\n *\n * useEventListener(player, 'playingChange', ({ isPlaying }) => {\n * console.log('Player is playing:', isPlaying);\n * });\n *\n * return <VideoView player={player} />;\n * }\n * ```\n */\n function useEventListener(eventEmitter, eventName, listener) {\n // Always use the most recent version of the listener inside the effect,\n // without memoization so the listeners don't have to be swapped with every render.\n const listenerRef = (0, _react.useRef)(listener);\n listenerRef.current = listener;\n (0, _react.useEffect)(() => {\n const callback = (...args) => listenerRef.current(...args);\n const subscription = eventEmitter.addListener(eventName, callback);\n return () => subscription.remove();\n }, [eventEmitter, eventName, listenerRef]);\n }\n});","lineCount":79,"map":[[7,2,2,0],[7,6,2,0,"_react"],[7,12,2,0],[7,15,2,0,"require"],[7,22,2,0],[7,23,2,0,"_dependencyMap"],[7,37,2,0],[8,2,6,0],[9,0,7,0],[10,0,8,0],[12,2,14,0],[13,0,15,0],[14,0,16,0],[16,2,22,0],[17,0,23,0],[18,0,24,0],[20,2,32,0],[21,0,33,0],[22,0,34,0],[23,0,35,0],[24,0,36,0],[25,0,37,0],[26,0,38,0],[27,0,39,0],[28,0,40,0],[29,0,41,0],[30,0,42,0],[31,0,43,0],[32,0,44,0],[33,0,45,0],[34,0,46,0],[35,0,47,0],[36,0,48,0],[37,0,49,0],[38,0,50,0],[39,2,51,7],[39,11,51,16,"useEvent"],[39,19,51,24,"useEvent"],[39,20,57,2,"eventEmitter"],[39,32,57,40],[39,34,58,2,"eventName"],[39,43,58,23],[39,45,59,2,"initialValue"],[39,57,59,36],[39,60,59,39],[39,64,59,43],[39,66,60,54],[40,4,61,2],[40,10,61,8],[40,11,61,9,"event"],[40,16,61,14],[40,18,61,16,"setEvent"],[40,26,61,24],[40,27,61,25],[40,30,61,28],[40,34,61,28,"useState"],[40,49,61,36],[40,51,62,4,"initialValue"],[40,63,63,2],[40,64,63,3],[41,4,64,2],[41,10,64,8,"listener"],[41,18,64,16],[41,21,64,20,"event"],[41,26,64,56],[41,30,64,61,"setEvent"],[41,38,64,69],[41,39,64,70,"event"],[41,44,64,75],[41,45,64,76],[42,4,66,2,"useEventListener"],[42,20,66,18],[42,21,66,19,"eventEmitter"],[42,33,66,31],[42,35,66,33,"eventName"],[42,44,66,42],[42,46,66,44,"listener"],[42,54,66,98],[42,55,66,99],[43,4,68,2],[43,11,68,9,"event"],[43,16,68,14],[44,2,69,0],[46,2,71,0],[47,0,72,0],[48,0,73,0],[49,0,74,0],[50,0,75,0],[51,0,76,0],[52,0,77,0],[53,0,78,0],[54,0,79,0],[55,0,80,0],[56,0,81,0],[57,0,82,0],[58,0,83,0],[59,0,84,0],[60,0,85,0],[61,0,86,0],[62,0,87,0],[63,0,88,0],[64,0,89,0],[65,0,90,0],[66,0,91,0],[67,0,92,0],[68,2,93,7],[68,11,93,16,"useEventListener"],[68,27,93,32,"useEventListener"],[68,28,97,2,"eventEmitter"],[68,40,97,40],[68,42,97,42,"eventName"],[68,51,97,63],[68,53,97,65,"listener"],[68,61,97,89],[68,63,97,97],[69,4,98,2],[70,4,99,2],[71,4,100,2],[71,10,100,8,"listenerRef"],[71,21,100,19],[71,24,100,22],[71,28,100,22,"useRef"],[71,41,100,28],[71,43,100,45,"listener"],[71,51,100,53],[71,52,100,54],[72,4,101,2,"listenerRef"],[72,15,101,13],[72,16,101,14,"current"],[72,23,101,21],[72,26,101,24,"listener"],[72,34,101,32],[73,4,103,2],[73,8,103,2,"useEffect"],[73,24,103,11],[73,26,103,12],[73,32,103,18],[74,6,104,4],[74,12,104,10,"callback"],[74,20,104,18],[74,23,104,21,"callback"],[74,24,104,22],[74,27,104,25,"args"],[74,31,104,36],[74,36,104,41,"listenerRef"],[74,47,104,52],[74,48,104,53,"current"],[74,55,104,60],[74,56,104,61],[74,59,104,64,"args"],[74,63,104,68],[74,64,104,69],[75,6,105,4],[75,12,105,10,"subscription"],[75,24,105,22],[75,27,105,25,"eventEmitter"],[75,39,105,37],[75,40,105,38,"addListener"],[75,51,105,49],[75,52,106,6,"eventName"],[75,61,106,15],[75,63,107,6,"callback"],[75,71,108,4],[75,72,108,5],[76,6,110,4],[76,13,110,11],[76,19,110,17,"subscription"],[76,31,110,29],[76,32,110,30,"remove"],[76,38,110,36],[76,39,110,37],[76,40,110,38],[77,4,111,2],[77,5,111,3],[77,7,111,5],[77,8,111,6,"eventEmitter"],[77,20,111,18],[77,22,111,20,"eventName"],[77,31,111,29],[77,33,111,31,"listenerRef"],[77,44,111,42],[77,45,111,43],[77,46,111,44],[78,2,112,0],[79,0,112,1],[79,3]],"functionMap":{"names":["<global>","useEvent","listener","useEventListener","useEffect$argument_0","callback","<anonymous>"],"mappings":"AAA;OCkD;mBCa,yDD;CDK;OGwB;YCU;qBCC,gDD;WEM,2BF;GDC;CHC"}},"type":"js/module"}]} |