replugged icon indicating copy to clipboard operation
replugged copied to clipboard

feat: prevent executing original function multiple times

Open yofukashino opened this issue 8 months ago • 1 comments

Changes the instead patch logic to accept a function as return value from callback. So that it can race condition functions like send message get executed only once

Code Example:


  import { Injector, common, webpack } from "replugged";
 
  const injector = new Injector();
 
  export async function start() {
    injector.after(common.messages, "sendMessage", async (_, origFunc) => {
      await Promise.resolve();
      return origFunc;
    });
  }
 
  export function stop() {
    injector.uninjectAll();
  }

yofukashino avatar Apr 03 '25 02:04 yofukashino

Deploy Preview for replugged-docs failed.

Name Link
Latest commit f131e7377eac3664ac0c1dbe2c8a8f7efb73a45e
Latest deploy log https://app.netlify.com/projects/replugged-docs/deploys/68a47c37fd63a80008337f7d

netlify[bot] avatar Apr 03 '25 02:04 netlify[bot]