@applicaster/quick-brick-default-app-state

Plugin designed to handle global app state changes. Depends on events emmitted by AppStateDecorator; active, background, isVisible, and other events.

Usage no npm install needed!

<script type="module">
  import applicasterQuickBrickDefaultAppState from 'https://cdn.skypack.dev/@applicaster/quick-brick-default-app-state';
</script>

README

Quick Brick Default App State

This plugin is meant to provide our application with some default behaviors when the app goes to the background, or the foreground.

At the moment the default interactions are:

  • When app goes to background: pause playback, and if web close the app
  • When app returns to foreground: resume playback

This plugin is also meant to be an example to show that any plugin and hook on to app state by declaring the following on export:

export default {
  isAppStateListener: true,
  listenTo: ["change", "visible"],
  weight: 0,
  run: run(),
};
  • isAppStateListener: is this a plugin that listens to appState
  • listenTo: what events do you want this plugin to listen to
  • weight: when there are many appState plugins determines the order they would render
  • run: method you would like to run on init of plugin