Home Manual Reference Source Test
public class | source

Host

You can directly use an instance of this class. host

A class in charge of communicating back and forth with the native app.

There should be no need to modify/extend this class as it uses Playback to build the messages to send and as the receiver of all messages from the MPRIS2 interfase

Constructor Summary

Public Constructor
public

constructor(playback: Playback, carrier: Carrier, port: Object)

Member Summary

Public Members
public

A carrier for caching and building the payloads

public

The playback to interact with

public

A chrome.runtime.Port

public

The default Payload.Identity for the MPRIS2 Interface

Method Summary

Public Methods
public

change()

Send a change message to host app

public

Native application wants to run a command on playback

public

get(_: string, propName: MessageProperty): number | void

Native application wants to Get a property from client

public

Listener for messages from native application (aka: mpris interface)

public

quit()

Send a quit message to host

public

return(method: MessageMethod, args: *)

public

seeked(player: Player)

Send a seeked message to host

public

sendMessage(type: MessageType, payload: Object | number)

Send a message to host app

public

set(_: string, propName: MessageProperty, newValue: number | LoopStatus | boolean)

Native application wants to Set a property in the client.

public

start(player: Player)

Set player as active player and send data to native app

Public Constructors

public constructor(playback: Playback, carrier: Carrier, port: Object) source

Params:

NameTypeAttributeDescription
playback Playback

the playback of the current site

carrier Carrier
port Object

see https://developer.chrome.com/apps/runtime#type-Port

Public Members

public carrier: Carrier source

A carrier for caching and building the payloads

public playback: Playback source

The playback to interact with

public port: Object source

A chrome.runtime.Port

See:

public source: string source

The default Payload.Identity for the MPRIS2 Interface

Public Methods

public change() source

Send a change message to host app

public command(name: MessageMethod) source

Native application wants to run a command on playback

Params:

NameTypeAttributeDescription
name MessageMethod

public get(_: string, propName: MessageProperty): number | void source

Native application wants to Get a property from client

Params:

NameTypeAttributeDescription
_ string

org.mpris.MediaPlayer2.Player

propName MessageProperty

property that should be returned

Return:

number | void

public messageListener(request: Object) source

Listener for messages from native application (aka: mpris interface)

Params:

NameTypeAttributeDescription
request Object
request.method MessageMethod
request.args Array

public quit() source

Send a quit message to host

public return(method: MessageMethod, args: *) source

Params:

NameTypeAttributeDescription
method MessageMethod
args *

public seeked(player: Player) source

Send a seeked message to host

Params:

NameTypeAttributeDescription
player Player

public sendMessage(type: MessageType, payload: Object | number) source

Send a message to host app

Params:

NameTypeAttributeDescription
type MessageType
payload Object | number
  • optional

public set(_: string, propName: MessageProperty, newValue: number | LoopStatus | boolean) source

Native application wants to Set a property in the client.

Params:

NameTypeAttributeDescription
_ string

org.mpris.MediaPlayer2.Player

propName MessageProperty

property to set

newValue number | LoopStatus | boolean
  • optional

depends on the property to set

public start(player: Player) source

Set player as active player and send data to native app

Params:

NameTypeAttributeDescription
player Player