Spider Monkey Panel

All SMP panels are defined with JavaScript, which is:

  • Implemented via Mozilla SpiderMonkey engine (ESR68).
  • Conformant with ECMAScript 2019 (with the exception of modules and some RegExp features).
  • Has built-in ActiveX support (so Microsoft.XMLHTTP can be used for network access).
  • Has various extensions for managing foobar2000 and interacting with WinAPI.
  • Has no built-in web browser-specific objects: e.g. XMLHttpRequest, Web Workers API and etc.

Table of Contents


API description

Handling foobar2000 events

Foobar2000 and panel events are translated to callback invocations (see callbacks section for the full list), for example:

Note: for performance reasons it's advised to define only those callbacks that you actually need.

Controlling foobar2000 and accessing WinAPI

SMP provides a lot of JavaScript extensions to simplify the work with foobar2000, which are divided in the following namespaces:

  • fb: functions for controlling foobar2000 and accessing it's data.
  • gdi: functions for working with graphics. Most of them are wrappers for Gdi and GdiPlus methods.
  • plman: functions for managing foobar2000 playlists.
  • console: has only one method log, which is used for logging messages to foobar2000 console.
  • utils: various utility functions.
  • window: functions for working with the current SMP panel and accessing it's properties.

Web and file-system access

Built-in ActiveX support further expands the range of available features and allows for easy file-system and web access:

  • Microsoft.XMLHTTP: this object can be used in place of XMLHttpRequest for web access.
  • FileSystemObject: used for file-system access (see MSDN documentation).

Example:

var xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');

Samples

SMP includes some samples which demonstrate it's API usage (see samples sub-folder of your foo_spider_monkey_panel installation):

See samples/readme.md for more info.

Links

Homepage
Support thread
Changelog
Detailed list of API Changes

Credits