Global

Methods

clearInterval(timerID)

Parameters:
Name Type Description
timerID number

clearTimeout(timerID)

Parameters:
Name Type Description
timerID number

include(path, optionsopt)

Evaluates the script in file.
Similar to `eval(utils.ReadTextFile(path))`, but provides more features:
- Has `include guards` - script won't be evaluated a second time if it was evaluated before in the same panel.
- Has script caching - script file will be read only once from filesystem (even if it is included from different panels).
- Has better error reporting.

Note: when the relative `path` is used it will be searched in the following paths:
- `${current_package_path}/scripts/${path}`, if the panel uses a package script.
- `${current_script_path}/${path}`, if the script is not a top-level `in-memory` script.
- `${fb.ComponentPath}/${path}`, otherwise.
Parameters:
Name Type Attributes Description
path string Absolute or relative path to JavaScript file.
options object <optional>
Properties
Name Type Attributes Default Description
always_evaluate boolean <optional>
false If true, evaluates the script even if it was included before.
Example

Include sample from `foo_spider_monkey_panel`

include('samples/complete/properties.js')

setInterval(func, delay, …func_args) → {number}

Parameters:
Name Type Attributes Description
func function
delay number
func_args * <repeatable>
Returns:
number

setTimeout(func, delay, …func_args) → {number}

Parameters:
Name Type Attributes Description
func function
delay number
func_args * <repeatable>
Returns:
number
Example
// See `samples/basic/Timer.js`

Type Definitions

ArtPromiseResult

Properties:
Name Type Attributes Description
image GdiBitmap <nullable>
null on failure
path string path to image file (or track file if image is embedded)

float

JsMemoryStats

Return value of window.JsMemoryStats.
Properties:
Name Type Description
MemoryUsage number Memory usage of the current panel (in bytes)
TotalMemoryUsage number Total memory usage of all panels (in bytes)
TotalMemoryLimit number Maximum allowed memory usage for the component (in bytes).
If the total memory usage exceeds this value, all panels will fail with OOM error.

JsPackageDirs

Note: returned directories are not guaranteed to exist.
Properties:
Name Type Description
Root string Root directory of the package
Assets string Directory inside package folder that contains assets
Scripts string Directory inside package folder that contains scripts
Storage string Persistent and unique directory inside foobar2000 profile folder that can be used to store runtime data (e.g. cache)

JsPackageInfo

Return value of window.GetPackageInfo.
Properties:
Name Type Description
Version string Package version
Directories JsPackageDirs Package directories

ScriptInfo

Return value of window.ScriptInfo.
Note: package_id is only present when the panel script is a package.
Properties:
Name Type Attributes Description
Name string
Author string <optional>
Version string <optional>
PackageId string <optional>