Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
Cómo eliminar el detector de eventos o el emisor de detectores en React Native

Estoy tratando de eliminar un detector de eventos. La forma antigua está en desuso. Se nos dice que usemos .remove(). No estoy seguro de cómo refactorizar mi código para hacerlo. Estoy usando un componente de clase.

¿Puede proporcionar un ejemplo de cómo eliminar el detector de eventos? Actualmente, mi detector de eventos está dentro de otra función. Lo tengo de esa manera, ya que es posible que necesite crear otro detector de eventos cada vez que se presiona el botón y necesito eliminar el detector después de que se ejecuta la función.

 startProcess = (result) => { // stuff for running process console.log("your function is running its process"); //deprecated but easy way to remove the event listener below // eventEmitter.removeListener('PreparePaywallFinished', onPreparePaywallFinished); //new way to remove event listen use remove() method on the EventSubscription returned by addEventListener() this.subscribeStartProcess.remove; }; handleBtnPress = () => { // the listener eventEmitter.addListener("onMidiStart", this.startProcess); // emitter NativeModules.midiBridgeStart(true, 2); }; render(){ return <Button title='press' onPress={()=> handleBtnPress() /> }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puedes usar

 window.removeEventListener('onMidiStart', handleonMidiStart);

el segundo argumento en removeEventListener es una variable para identificar qué evento de la lista se está eliminando. Se proporciona una descripción detallada aquí ingrese la descripción del enlace aquí

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!