This is a tool to accelerate your Tampermonkey user scripts development.
It simply checks for specific file modifications inside designated folders (like "/projects" folder by default for example). Once the slightest change has been detected, the server will send the changed file source code to the client (i.e browser) via long-polling technique, which in turn will 'overwrite' the old code with the new one.
AutoHotkey, if your planning to launch the hot-reload server via .ahk file.
Tampermonkey with permission to allow scripts to access local files.
Since this Hot-Reload currently works by taking advantage of HTTP long-polling technique, that means it has to adhere to Content Security Policy (CSP) - in short, the website your writing the user scripts for has to allow HTTP requests (lucky for us, most of them do).
- Launch the hot-reload server - (ReloadServer.ahk or ReloadServer.exe).
- Import the hot-reload client file inside your "Tampermonkey" script (via @require directive for example).
- Enjoy.
Note, that there is also the possibility to watch for file changes in custom folders.
You can do it by using the following API methods:
// Bind 'D:\Another Script Folder\GameBot' folder to look for "user.js" and ".ahk" file changes.
let watchDog1 = hotreload.bind("D:\\Another Script Folder\\GameBot", "user.js|.ahk");
// Stop looking for 'watchDog1' changes.
watchDog1.unbind();