Options
All
  • Public
  • Public/Protected
  • All
Menu

Module plugins

Index

Functions

Functions

load

  • load(packageName: string): Promise<any>
  • Load a plugin and return the module.exports object exported by the plugin.

    If the plugin is not installed or does not exist, throw a PluginLoadException.

    example
    "nodejs";
    async function main() {
        const plugins = require("plugins");
        const ffmpeg = await plugins.load("org.autojs.plugin.ffmpeg");
        console.log(ffmpeg.inProcess.exec('-i /path/to/mp4.mp4 /path/to/mp3.mp3'));
    }
    main().catch(console.error);
    

    Parameters

    • packageName: string

      plugin package name

    Returns Promise<any>

    plugin exported object

unload

  • unload(packageName: string): Promise<boolean>
  • Unload a plugin. Using the plugin exported object is an undefined behavior after unloading.

    Parameters

    • packageName: string

    Returns Promise<boolean>

unloadAll

  • unloadAll(): Promise<void>
  • Unload all plugins. Using the plugin exported object is an undefined behavior after unloading.

    Returns Promise<void>