Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl #1

Closed
SamiSuleiman opened this issue Sep 21, 2023 · 0 comments
Closed

impl #1

SamiSuleiman opened this issue Sep 21, 2023 · 0 comments

Comments

@SamiSuleiman
Copy link
Owner

SamiSuleiman commented Sep 21, 2023

this might help for state management

async function activate (context) {
  const state = stateManager(context)
  
  const {
    lastPaletteTitleApplied
  } = state.read()

  await state.write({
    lastPaletteTitleApplied: 'foo bar'
  })

}


function stateManager (context) {
  return {
    read,
    write
  }

  function read () {
    return {
      lastPaletteTitleApplied: context.globalState.get('lastPaletteApplied')
    }
  }

  async function write (newState) {
    await context.globalState.update('lastPaletteApplied', newState.lastPaletteTitleApplied)
  }
}

webview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant