StoragePlugin

View source

ExtendsPlugin

Adds browser storage resources to an App.

The plugin provides fresh Session, Storage, and Cookies resources for application code. Use them for tab-scoped values, origin-scoped values, and document cookies respectively.

StoragePlugin requires CorePlugin and ReflectPlugin. Register these dependencies before the storage plugin; plugin dependencies are checked but are not installed automatically.

Examples

import { App } from '@wimaengine/app'
import { CorePlugin } from '@wimaengine/core'
import { ReflectPlugin } from '@wimaengine/reflect'
import { Session, StoragePlugin } from '@wimaengine/storage'

const app = new App()
app
  .registerPlugin(new ReflectPlugin())
  .registerPlugin(new CorePlugin())
  .registerPlugin(new StoragePlugin())
  .run()

// Access the resources from an app world.
function saveScreen(world) {
  world.getResource(Session).set('screen', 'home')
}

Constructor


constructor()

Methods