Addon

Addon

Add-on for Translator++
Addon is an additional script that is modular, can be added and removed as needed.
Every folder in www/addons will automatically be loaded as a Translator++ addon.
The this keyword in the top-level scope of javascript that is loaded as an addon will refer to the instance of this class.

Constructor

new Addon(path, options)

Source:
Parameters:
Name Type Description
path string
options

Methods

getPathRelativeToRoot() → {string}

Description:
  • Get relative path of the addon

Source:
Returns:
  • back slashes based add-on's path relative to Translator++ installation. No trailing slash.
Type
string

getRelativePath() → {string}

Description:
  • Get relative path of the addon

Source:
Returns:
  • forward slashes based add-on's path relative to Translator++ installation. No trailing slash.
Type
string

globalizeNodeModules()

Description:
  • Register addon's node modules to the global scope global

Source:
Since:
  • 5.8.13

require(moduleName)

Description:
  • Load node modules that installed locally

Source:
Since:
  • 5.8.13
Parameters:
Name Type Description
moduleName string

Name of the installed module

resolvePath(path) → {String}

Description:
  • Resolve the relative path from the root of a local path relative to addon
    Translates the trailing slash to the root path of the addon

Source:
Parameters:
Name Type Description
path String
Returns:
  • Path to the addon
Type
String

(static) isExternalScript(pathName)

Description:
  • Detect whether pathName contains "ao://"

Source:
Parameters:
Name Type Description
pathName

Events

loaded

Description:
  • Addon is loaded and ready

Source:
Type:

onLoaded

Description:
  • Addon is loaded and ready

Source:
Deprecated:
  • Deprecated since 4.12.1. Use `loaded` instead
Type: