Skip to content

How to read settings inside background app-service? #388

Answered by mrklos
mrklos asked this question in Q&A
Discussion options

You must be logged in to vote

Figured it out:

In AppSideService (using ZML library)

onSettingsChange({ key, newValue, oldValue }) {
  if (key === 'settings' && newValue) {
    settings = newValue ? JSON.parse(newValue) : DEFAULT_SETTINGS;
  }
},
onRequest(req, res) {
  if (req.method === 'GET_SETTINGS') {
    res(null, {
      result: settings
    })
  }
},

and app service can call this.request({
method: 'GET_SETTINGS'
})

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mrklos
Comment options

Answer selected by mrklos
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