Skip to content
Jesse R. Jose edited this page Aug 13, 2017 · 2 revisions

The provided Api lets you trigger things like the screen shake or an audio, and even control the combo mode.

You can get the api object in your plugin in the enable function, like this:

'use babel'

module.exports = {
  enable(api) {
    this.api = api;
  }
}

Api object

These are the functions provided by the api:

  // Shakes the screen, optionally you can pass an intensity value
  // it can be either 'max' or 'min' 
  shakeScreen(intensity = null) {}
  
  // Plays an audio, pass an audio object to be played
  // or call it without it to play the selected audio 
  // by the user in the package's settings.
  playAudio(audio) {}

  // Gets the current editor, null if the active pane is not a text editor.
  getEditor() {}

  // Gets the current editor element, null if the active pane is not a text editor.
  getEditorElement() {}

  // Gets the combo api
  getCombo() {}

Shake screen and play audio

In the package's settings you can disable/enable the screen shake and the play audio plugins, but these options are only for the plugins the triggers these action on typing.

Additionally there are the enable/disable configs for the screen shake and play audio which acts in a global way. So if there are many plugins that use the audio player, the user can disable all the audio in the Play Audio section or disable one by one the plugins.

Combo api

The combo api lets you control the combo mode, these are the functions it provides:

  // Increase the combo streak, by default 1.
  increase(n = 1) {}

  // Decreases the combo streak, by default 1.
  decrease(n = 1) {}

  // Shows an exclamation in the combo, the word is the text to exclame
  // and the type can be anything to be adding as a class.
  exclame(word = null, type = null) {}

  // Resets the combo streak to 0.
  resetCounter() {}

  // Gets the current combo mode level.
  getLevel() {}

  // Gets the current streak count.
  getCurrentStreak() {}

  // Gets whether or not the combo mode is enabled.
  isEnable() {}
Clone this wiki locally