Skip to content
Discussion options

You must be logged in to vote

Create an instance of LocalStorage in app.js. Then use it as a global object in device/bg context.

// app.js
import { LocalStorage } from "@zos/storage";

App({ 
  globals: { storage: new LocalStorage() },
  onCreate() {}, 
  onDestroy() {} 
})

// device/bg
const storage = getApp().globals.storage;

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by adicu-mwb
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants