Reaction

This is used in the file of a Trigger.

Media

Sound

FieldTypeRequiredDefaultDescription
filestringโœ”๏ธnoneFile in workspace workspace:// or URL
volumenumberโŒ1Volume between 0 and 1
Return

Return a Promise who resolve when sound is finished.

Example
module.exports = async (data, services) => {
await services.player.play("workspace://audio/mario.mp3", 1)
}

Voice (TTS)

FieldTypeRequiredDefaultDescription
textstringโœ”๏ธnoneWhat the voice should say
volumenumberโŒ1Volume between 0 and 1
Return

Return a Promise who resolve when sound is finished.

Example
module.exports = async (data, services) => {
await services.media.tts("Coucou, toi !", 0.75)
}

OS

Clipboard

FieldTypeRequiredDefaultDescription
textstringโœ”๏ธnone
Return

Return Promise<void>.

Example
module.exports = async (data, services) => {
await services.os.toClipboard("waza")
}

External link

FieldTypeRequiredDefaultDescription
keystringโœ”๏ธnone
Return

Return Promise<void>.

Example
module.exports = async (data, services) => {
await services.os.openExternal("https://evntboard.io/")
}

Beep

Return

Return Promise<void>.

Example
module.exports = async (data, services) => {
await services.os.beep()
}

Notification

FieldTypeRequiredDefaultDescription
titlestringโœ”๏ธnone
bodystringโœ”๏ธnone
Return

Return Promise<void>.

Example
module.exports = async (data, services) => {
await services.os.notification("Coucou", "C'est moi")
}

File

Write

FieldTypeRequiredDefaultDescription
filestringโœ”๏ธnone
datastringโœ”๏ธnone
Return

void

Example
module.exports = async (data, services) => {
services.file.write("monfichier.txt", data)
}

Read

FieldTypeRequiredDefaultDescription
filestringโœ”๏ธnone
Return

string

Example
module.exports = async (data, services) => {
const content = services.file.read("monfichier.txt")
console.log(content)
}

Append

FieldTypeRequiredDefaultDescription
filestringโœ”๏ธnone
datastringโœ”๏ธnone
Return

void

Example
module.exports = async (data, services) => {
services.file.append("monfichier.txt", "\ncoucou")
}

Variable

Get

FieldTypeRequiredDefaultDescription
keystringโœ”๏ธnone
Return

Return Promise<any>.

Example
module.exports = async (data, services) => {
const valeur = services.variable.get("waza")
console.log({ valeur })
}

Set

FieldTypeRequiredDefaultDescription
keystringโœ”๏ธnone
dataanyโœ”๏ธnone
Return

Return the value set

Example
module.exports = async (data, services) => {
const valeur = services.variable.set("waza", "test")
console.log({ valeur })
}
module.exports = async (data, services) => {
const valeur = services.variable.set("waza", 42)
console.log({ valeur })
}
module.exports = async (data, services) => {
const valeur = services.variable.set("waza", { test: 42 })
console.log({ valeur })
}

Utils

Sleep

FieldTypeRequiredDefaultDescription
msnumberโœ”๏ธnoneA number
Return

Return Promise<void>.

Example
module.exports = async (data, services) => {
await services.utils.sleep(5000)
}

Board

Get Image

Get board image at runtime

Return

string

Example
module.exports = async (data, services) => {
services.board.getImage("id_board")
}

Get Color

Get board color at runtime

Return

string

Example
module.exports = async (data, services) => {
services.board.getColor("id_board")
}

Update Image

update board image at runtime

Return

string

Example
module.exports = async (data, services) => {
services.board.updateImage("id_board", "workspace://image/waza.png")
}

Update Color

Update board color at runtime

Return

string

Example
module.exports = async (data, services) => {
services.board.updateColor("id_board", "rbga")
}

Switch board

switch board at runtime

Return

string

Example
module.exports = async (data, services) => {
services.board.switch("id_board", "emitter")
}

Button

Get Image

Get button image at runtime

Return

string

Example
module.exports = async (data, services) => {
services.button.getImage("id_button")
}

Get Color

Get button color at runtime

Return

string

Example
module.exports = async (data, services) => {
services.button.getColor("id_button")
}

Get Text

Get button text at runtime

Return

string

Example
module.exports = async (data, services) => {
services.button.getColor("id_button")
}

Update Image

update button image at runtime

Return

string

Example
module.exports = async (data, services) => {
services.button.updateImage("id_button", "workspace://image/waza.png")
}

Update Color

Update button color at runtime

Return

string

Example
module.exports = async (data, services) => {
services.button.updateColor("id_button", "rbga")
}

Update Text

Update button text at runtime

Return

string

Example
module.exports = async (data, services) => {
services.button.updateText("id_button", "rbga")
}

Event

New

FieldTypeRequiredDefaultDescription
objectobjectโœ”๏ธnoneYour event data !
Return

void

Example
module.exports = async (data, services) => {
services.event.newEvent('my-event', {
data: 42
})
}

Plugin

FieldTypeRequiredDefaultDescription
plugin-idstringโœ”๏ธnoneYour plugin id !
plugin-methodsstringโœ”๏ธnoneYour plugin methods !
plugin-paramsanyโŒnoneYour plugin params !
Return

Return Promise<any>.

Example
module.exports = async (data, services) => {
services.plugin('plugin-id', 'plugin-methods', 'param1', 'param2', '...')
}