Main app support classes and functions

App

Constructors

Properties

Methods

Events

Constructors

Properties

backgroundTasks: BackgroundTasks

Gets background tasks manager

collections: Collections

Undocumented

db: DB

Gets Database support class

debug?: any

Undocumented

devices: Devices

Gets portable devices manager class

dialogs: Dialogs

Gets dialogs class

downloader: Downloader

Download manager class

fileFormats: FileFormats

Gets class for operating file formats

filesystem: Filesystem

Gets class for filesystem operations

gotoPartyMode: boolean

Undocumented

hotkeys: Hotkeys

Gets hotkeys class

importer: Importer

Gets class for importer operations

inPartyMode: boolean

Undocumented

masks: Masks

Gets class for masks operations

platform: string

Gets application platform, possible values are 'win', 'mac'

player: Player

Gets Player object

playlists: Playlists

Gets playlists manager class

podcasts: Podcasts

Gets podcasts manager class

registry: RegistryAccess

Undocumented

settings: Settings

Gets settings class

sharing: Sharing

Gets media sharing (UPnP/DLNA) manager class

sleeper: Shutdowner

Sleep timer class

tests?: any

Testing functionality for internal builds.

trackOperation: TrackOperation

Gets Track operations class

trayIcon: TrayIcon

Gets class for tray icon operations

utils: Utils

Gets utils class

versionBuild: number

Gets application version build

versionHi: number

Gets application version major

versionLo: number

Gets application version minor

versionRelease: number

Gets application version release

versionString: string

Gets application version string

Methods

  • Send debug string to event list.

    Parameters

    • s: string

    Returns void

  • Parameters

    • parentID: number
    • URL: string
    • title: string
    • id: number

    Returns void

    Undocumented

  • Parameters

    • parentID: number
    • URL: string
    • title: string
    • id: number

    Returns void

    Undocumented

  • Allow app to collect garbage.

    Returns void

  • Returns boolean

    Undocumented

  • Returns boolean

    Undocumented

  • Returns void

    Undocumented

  • Parameters

    • Rest ...params: any[]

    Returns void

    Undocumented

  • Returns void

    Undocumented

  • Returns void

    Undocumented

  • Close application.

    Parameters

    • Rest ...params: any[]

    Returns void

  • Parameters

    • Rest ...params: any[]

    Returns SharedTree

    Undocumented

  • Creates new window with URL. Currently these parameters are supported: left, top, width, height - position and size of the window posSaveName - save/restore name of the window isPopup (true/false) - is popup window

    Parameters

    • Rest ...params: any[]

      Parameters (optional)

    Returns SharedWindow

    SharedWindow

  • Get current layout name.

    Returns Skin

  • Get current skin.

    Returns Skin

  • Parameters

    • id: number

    Returns void

    Undocumented

  • Parameters

    • id: number

    Returns void

    Undocumented

  • Download and install language pack

    Parameters

    • langID: string

      id of a language to download

    Returns Promise<any>

  • Parameters

    • enable: boolean

    Returns void

    Undocumented

  • Returns void

    Undocumented

  • Finds whether updates are available for the addon list

    Parameters

    Returns Promise<any>

  • Stores all persistent values to hard drive

    Returns void

  • Returns boolean

    Since

    5.0.2

  • Get list of addons. As archiveType parameter script can set type of addons to retrieve or 'all' for all addons.

    Parameters

    • archiveType: string

      Type of the addon

    • Optional ids: string[]

      List of allowed addon IDs to include in the list

    Returns AddonList

  • Returns AlbumList

    Undocumented

  • Gets collections manager class

    Returns Collections

  • Get's current player type. Possible values: 0 - main player 1 - micro player 2 - mini player

    Returns number

  • Creates new SharedIniFile interface to be used for reading and writing values from/to MediaMonkey.ini

    Returns IniFileAccess

  • Get SkinList of available layouts. Selected item in this list is current layout.

    Returns SkinList

  • Gets object by its type and additional info. Can return nil only if passed JS object contains parameter canReturnEmpty: true

    Parameters

    • objectType: string

      like 'album', 'genre'

    • info: {
          [key: string]: any;
      }

      JS object with specifying info in its properties, like id, name, mbgid

      • [key: string]: any

    Returns Promise<any>

  • Parameters

    • Rest ...params: any[]

    Returns WebNodesList

    Undocumented

  • Get SkinList of available skins. Selected item in this list is current skin.

    Returns SkinList

  • Parameters

    • Rest ...params: any[]

    Returns Tracklist

    Undocumented

  • Gets JS value/object previously stored by setValue,

    Parameters

    • id: string

      unique id of the stored value

    • defaultValue: any

      object to pass (default value)

    Returns any

    object (modified object from the second parameter)

  • Parameters

    • Rest ...params: any[]

    Returns WebNodesList

    Undocumented

  • Returns void

    Undocumented

  • Return true when app is on safe mode where scripts are not loaded and default skin/layout is set.

    Returns boolean

  • Install new addon or update existing addon.

    Parameters

    • path: string

      Filename of the addon to install (or download URL)

    • Optional addon: Addon

      Addon to update

    Returns Promise<any>

  • Returns boolean

    Undocumented

  • Sets event listener for given object.

    NOTE: In this documentation, classes and interfaces' events are labeled event_(eventKey), e.g. event_mousestatechanged. Do not include event_ in the eventKey.

    Parameters

    • object: any

      Object where to set listener

    • eventKey: string

      Event of the listener

    • callback: Function

      Method for callback dispatch

    • Optional capture: boolean

      Capture mode

    Returns Function

    The same callback function that was provided

    Example

    app.listen(app, 'hotkey', (data) => {
    uitools.toastMessage.show('Received ' + data.hotkey.toUpperCase());
    });

    var serverList = app.sharing.getRemoteServers();
    app.listen( serverList, 'change', () => {
    // server was added to (or removed) from the serverList
    });
  • Load defined layout.

    Parameters

    • name: string

      Name of the layout to load

    Returns void

  • Fire the customLessChange event.

    Returns void

  • Fire the lessChange event (Notify all windows when LESS is recompiled in the main window)
    NOTE: Added in 5.0.2

    Returns void

    Since

    5.0.2

  • Fire the settingsChange event.

    Returns void

  • Prevent app to collect garbage (must be in pair with allowCollect).

    Returns void

  • Returns void

    Undocumented

  • Remove JS value/object

    Parameters

    • id: string

      unique id of the stored value

    Returns void

  • Restart app. Using first optional parameter can restart in safe mode.

    Parameters

    • Optional safeMode: boolean

      True to restart in safe mode

    Returns void

  • Load defined skin.

    Parameters

    • skin: string | Skin

      File path of skin, OR Skin object i.e. from app.currentSkin()

    • Optional soft: boolean

      Whether to do a soft reload of JUST the window (HTML and JS) rather than a full app restart.

    Returns void

  • Returns void

    Undocumented

  • Stores JS value/object to be persistent

    Parameters

    • id: string

      unique id of the stored value

    • value: any

    Returns void

  • Parameters

    • value: boolean

    Returns void

    Undocumented

  • Gets/Sets whether app is in party mode

    Parameters

    • value: boolean

    Returns void

  • Switch to player in main window.

    Returns void

  • Switch to player in tray bar.

    Returns void

  • Switch to player in separate mini window.

    Returns void

  • Uninstall addon.

    Parameters

    • addon: Addon

      Addon to uninstall

    Returns Promise<any>

  • Removes event listeners of the object. If event/method are not provided, then all matching listeners are removed.

    Parameters

    • object: any

      Object of the listener

    • Optional eventKey: string

      Event name of the listener

    • Optional callback: Function

      Callback to be removed from the list of listeners

    • Optional capture: boolean

      capture mode

    Returns void

Events

event_afterReload: (() => void)

Event is called when app reload is done.

See App.listen

Type declaration

    • (): void
    • Returns void

event_beforeReload: (() => void)

Event is called just before app reload (like when skin is changed).

See App.listen

Type declaration

    • (): void
    • Returns void

event_close: (() => void)

Event is called when app is going to close.

See App.listen

Type declaration

    • (): void
    • Returns void

event_collectionChange: ((collection) => void)

Event is called when collection is changed.

Type declaration

    • (collection): void
    • Parameters

      Returns void

event_commonChange: ((...args) => void)

Event is called when something is changed (like artist were changed, new genre is added to DB etc.). Parameters of this event can be various based on change notification.

See App.listen

Type declaration

    • (...args): void
    • Parameters

      • Rest ...args: unknown[]

      Returns void

event_customLessChange: (() => void)

Event is called when custom LESS values are modified (see window.setLessValues()).

See App.listen

Type declaration

    • (): void
    • Returns void

event_dockChange: ((horizontal) => void)

Event is called when taskbar MM dock orientation changed.

See App.listen

Type declaration

    • (horizontal): void
    • Parameters

      • horizontal: boolean

        new taskbar dock is in horizontal orientation

      Returns void

event_hotkey: ((hotkey) => void)

Event is called when hotkey is received.

Type declaration

    • (hotkey): void
    • Parameters

      Returns void

event_idle: (() => void)

Event is called when app is idle.

See App.listen

Type declaration

    • (): void
    • Returns void

event_lessChange: (() => void)

Event is called when LESS is modified (e.g. skin options are changed).

See App.listen

Type declaration

    • (): void
    • Returns void

event_menuClosed: (() => void)

Event is called when app menu is closed.

See App.listen

Type declaration

    • (): void
    • Returns void

event_objectPinChange: (() => void)

Event is called any object is pinned to / unpinned from the media tree.

See App.listen

Type declaration

    • (): void
    • Returns void

event_playlistChange: ((playlist, changeType, newValue, oldValue) => void)

Event is called when playlist is changed in some way, additional params can detect the change type and new/old values
Note: Introduced in 5.0.3

Type declaration

    • (playlist, changeType, newValue, oldValue): void
    • Parameters

      • playlist: Playlist

        changed Playlist

      • changeType: "title" | "parent" | "new_child" | "child_removed"

        (possible values 'title', 'new_child', 'child_removed', 'parent' or undefined)

      • newValue: string | Playlist

        possible values are playlist object, string or undefined

      • oldValue: string | Playlist

        possible values are playlist object, string or undefined

      Returns void

Example

app.listen(app, 'playlistchange', (playlist, changeType, newValue, oldValue) => {
if (changeType == 'title')
uitools.toastMessage.show(playlist.title + ' renamed from ' + oldValue + ' to ' + newValue);
else if (changeType == 'new_child')
uitools.toastMessage.show(playlist.title + ' has new child ' + newValue.title);
else if (changeType == 'child_removed')
uitools.toastMessage.show(playlist.title + ' -- child was removed ' + newValue.title)
else if (changeType == 'parent')
uitools.toastMessage.show(playlist.title + ' parent changed from ' + oldValue.title + ' to ' + newValue.title);
});
event_remoteRequest: ((request) => void)

Event is called when a custom http request is received to our MediaServer

Type declaration

    • (request): void
    • Parameters

      • request: any

        received request

      Returns void

event_settingsChange: (() => void)

Event is called when settings were changed

See App.listen

Type declaration

    • (): void
    • Returns void

event_trackAdded: ((track) => void)

Event is called when new track is added to DB

See App.listen

Type declaration

    • (track): void
    • Parameters

      Returns void

event_trackChange: ((track) => void)

Event is called when any track is changed

See App.listen

Type declaration

    • (track): void
    • Parameters

      • track: Track

        changed track

      Returns void

event_trackModified: ((track) => void)

Event is called when a track is modified and changes are commited.

See App.listen

Type declaration

    • (track): void
    • Parameters

      • track: Track

        modified track

      Returns void

event_trayIconEvent: ((eventName, button, x, y) => void)

Event is called when app is received any command from taskbar icon. Possible event names are 'click', 'dblclick', 'mousedown', 'mouseup', 'mousemove', 'mouseenter', 'mouseexit', 'hintshow', 'hinthide', 'hinttimeout', 'hintclick'.

See App.listen

Type declaration

    • (eventName, button, x, y): void
    • Parameters

      • eventName: "click" | "dblclick" | "mousedown" | "mouseenter" | "mousemove" | "mouseup" | "mouseexit" | "hintshow" | "hinthide" | "hinttimeout" | "hintclick"

        name of the event

      • button: number

        button index

      • x: number

        x mouse position

      • y: number

        y mouse position

      Returns void