mirror of
https://github.com/pezkuwichain/pezkuwi-mobile-app.git
synced 2026-05-30 04:11:02 +00:00
1 line
7.2 KiB
Plaintext
1 line
7.2 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":["*"],"imports":1}}],"output":[{"data":{"code":"__d(function (global, require, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {\n \"use strict\";\n\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":81,"map":[[7,2,51,0,"exports"],[7,9,51,0],[7,10,51,0,"useEvent"],[7,18,51,0],[7,21,51,0,"useEvent"],[7,29,51,0],[8,2,93,0,"exports"],[8,9,93,0],[8,10,93,0,"useEventListener"],[8,26,93,0],[8,29,93,0,"useEventListener"],[8,45,93,0],[9,2,2,0],[9,6,2,0,"_react"],[9,12,2,0],[9,15,2,0,"require"],[9,22,2,0],[9,23,2,0,"_dependencyMap"],[9,37,2,0],[10,2,6,0],[11,0,7,0],[12,0,8,0],[14,2,14,0],[15,0,15,0],[16,0,16,0],[18,2,22,0],[19,0,23,0],[20,0,24,0],[22,2,32,0],[23,0,33,0],[24,0,34,0],[25,0,35,0],[26,0,36,0],[27,0,37,0],[28,0,38,0],[29,0,39,0],[30,0,40,0],[31,0,41,0],[32,0,42,0],[33,0,43,0],[34,0,44,0],[35,0,45,0],[36,0,46,0],[37,0,47,0],[38,0,48,0],[39,0,49,0],[40,0,50,0],[41,2,51,7],[41,11,51,16,"useEvent"],[41,19,51,24,"useEvent"],[41,20,57,2,"eventEmitter"],[41,32,57,40],[41,34,58,2,"eventName"],[41,43,58,23],[41,45,59,2,"initialValue"],[41,57,59,36],[41,60,59,39],[41,64,59,43],[41,66,60,54],[42,4,61,2],[42,10,61,8],[42,11,61,9,"event"],[42,16,61,14],[42,18,61,16,"setEvent"],[42,26,61,24],[42,27,61,25],[42,30,61,28],[42,34,61,28,"useState"],[42,40,61,36],[42,41,61,36,"useState"],[42,49,61,36],[42,51,62,4,"initialValue"],[42,63,63,2],[42,64,63,3],[43,4,64,2],[43,10,64,8,"listener"],[43,18,64,16],[43,21,64,20,"event"],[43,26,64,56],[43,30,64,61,"setEvent"],[43,38,64,69],[43,39,64,70,"event"],[43,44,64,75],[43,45,64,76],[44,4,66,2,"useEventListener"],[44,20,66,18],[44,21,66,19,"eventEmitter"],[44,33,66,31],[44,35,66,33,"eventName"],[44,44,66,42],[44,46,66,44,"listener"],[44,54,66,98],[44,55,66,99],[45,4,68,2],[45,11,68,9,"event"],[45,16,68,14],[46,2,69,0],[48,2,71,0],[49,0,72,0],[50,0,73,0],[51,0,74,0],[52,0,75,0],[53,0,76,0],[54,0,77,0],[55,0,78,0],[56,0,79,0],[57,0,80,0],[58,0,81,0],[59,0,82,0],[60,0,83,0],[61,0,84,0],[62,0,85,0],[63,0,86,0],[64,0,87,0],[65,0,88,0],[66,0,89,0],[67,0,90,0],[68,0,91,0],[69,0,92,0],[70,2,93,7],[70,11,93,16,"useEventListener"],[70,27,93,32,"useEventListener"],[70,28,97,2,"eventEmitter"],[70,40,97,40],[70,42,97,42,"eventName"],[70,51,97,63],[70,53,97,65,"listener"],[70,61,97,89],[70,63,97,97],[71,4,98,2],[72,4,99,2],[73,4,100,2],[73,10,100,8,"listenerRef"],[73,21,100,19],[73,24,100,22],[73,28,100,22,"useRef"],[73,34,100,28],[73,35,100,28,"useRef"],[73,41,100,28],[73,43,100,45,"listener"],[73,51,100,53],[73,52,100,54],[74,4,101,2,"listenerRef"],[74,15,101,13],[74,16,101,14,"current"],[74,23,101,21],[74,26,101,24,"listener"],[74,34,101,32],[75,4,103,2],[75,8,103,2,"useEffect"],[75,14,103,11],[75,15,103,11,"useEffect"],[75,24,103,11],[75,26,103,12],[75,32,103,18],[76,6,104,4],[76,12,104,10,"callback"],[76,20,104,18],[76,23,104,21,"callback"],[76,24,104,22],[76,27,104,25,"args"],[76,31,104,36],[76,36,104,41,"listenerRef"],[76,47,104,52],[76,48,104,53,"current"],[76,55,104,60],[76,56,104,61],[76,59,104,64,"args"],[76,63,104,68],[76,64,104,69],[77,6,105,4],[77,12,105,10,"subscription"],[77,24,105,22],[77,27,105,25,"eventEmitter"],[77,39,105,37],[77,40,105,38,"addListener"],[77,51,105,49],[77,52,106,6,"eventName"],[77,61,106,15],[77,63,107,6,"callback"],[77,71,108,4],[77,72,108,5],[78,6,110,4],[78,13,110,11],[78,19,110,17,"subscription"],[78,31,110,29],[78,32,110,30,"remove"],[78,38,110,36],[78,39,110,37],[78,40,110,38],[79,4,111,2],[79,5,111,3],[79,7,111,5],[79,8,111,6,"eventEmitter"],[79,20,111,18],[79,22,111,20,"eventName"],[79,31,111,29],[79,33,111,31,"listenerRef"],[79,44,111,42],[79,45,111,43],[79,46,111,44],[80,2,112,0],[81,0,112,1],[81,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"},"hasCjsExports":false},"type":"js/module"}]} |