Introduction
slicer features a simple JavaScript scripting API, useful for doing preprocessing on class files, e.g. deobfuscation.
Every script must default export two essential properties, load
and unload
functions, however it can also expose metadata to display to the user.
Scripts are meant to be fairly simple, but they can also be pretty extensive, so for convenience, a TypeScript+Rollup example project is provided here.
Context
Every script is assigned a “script context”, which provides them with the power to manipulate with slicer itself - you will need it for basically everything.
This context is always passed into load
and unload
, where you can access it:
Each context also has a parent context (context.parent
), in most cases it will be the “root context”.
The root context represents the slicer scripting engine itself, you can identify it by the script name (rootContext.script.name === "slicer"
) or the fact that it has no parent - it is the root after all (rootContext.parent === null
).