Last active
October 26, 2025 21:08
-
-
Save meowabyte/cce21f7837d4b5f302dfffc386e9c220 to your computer and use it in GitHub Desktop.
Script hooks into generic `Function.bind` function that serves purpose of binding `this` to custom value and returns the context, returning the original bind value after hit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Callback | |
| const foundContext = (ctx) => { | |
| console.log(ctx) | |
| } | |
| // Look for context by these keys | |
| const searchBy = [ | |
| "chat", | |
| "generateImage" | |
| ] | |
| Function.prototype.bind = (() => { | |
| const o = Function.prototype.bind | |
| return function (ctx) { | |
| if(typeof ctx !== "undefined" && searchBy.every(k => k in ctx)) { | |
| Function.prototype.bind = o | |
| foundContext(ctx) | |
| } | |
| return bindPrototype.apply(this, arguments) | |
| } | |
| })() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment