How to use the store2.set function in store2

To help you get started, we’ve selected a few store2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github poanetwork / token-wizard / test / components / Home / index.spec.js View on Github external
it(`should navigate to Home`, () => {
    // Given
    const wrapper = mount(
      
        
      
    )
    const createCrowdsaleComponentWrapper = wrapper.find(CreateCrowdsale)
    const instance = createCrowdsaleComponentWrapper.instance()
    const goToStepOneHandler = jest.spyOn(instance, 'goToStepOne')
    instance.forceUpdate()

    // When
    storage.set('DeploymentStore', { deploymentStep: 1 })
    const buttonCreateCrowdsale = createCrowdsaleComponentWrapper.find('.hm-Home_BtnNew')
    buttonCreateCrowdsale.simulate('click')

    // Then
    expect(buttonCreateCrowdsale.length).toBe(1)
    expect(goToStepOneHandler).toHaveBeenCalledTimes(1)
    expect(goToStepOneHandler).toHaveBeenCalledWith()
  })
github PacktPublishing / Hands-on-MERN-Stack-Web-Development / client / src / App.js View on Github external
emptyCart = () => {
    this.setState({ itemsInCart: [] });
    store.set('itemsInCart', []);
  };
github ritz078 / transform / components / Layout.js View on Github external
                  () => store.set("mode", this.state.checked ? "dark" : "light")
                )
github poanetwork / token-wizard / src / stores / autosave.js View on Github external
mobx.autorun(`autorun for ${storageKey}`, () => {
    if (firstRun) {
      const existingStore = storage.get(storageKey)

      if (existingStore) {
        mobx.extendObservable(store, deserialize(existingStore))
      }

      firstRun = false
    }

    storage.set(storageKey, mobx.toJS(store))
  })
}
github vanderleisilva / react-context / src / middlewares / localStorage.js View on Github external
export default state => {
  store.set(state.storeId, state);
  return state;
};
github lincenying / mmf-blog-vue2-ssr / src / pages / index.vue View on Github external
beforeRouteLeave (to, from, next) {
        const scrollTop = document.body.scrollTop
        const path = this.$route.path
        if (scrollTop) ls.set(path, scrollTop)
        else ls.remove(path)
        next()
    }
}
github lincenying / mmf-blog-vue2-ssr / src / Login.vue View on Github external
onFormComplete(res) {
            if (res.code === 200) {
                this.$store.dispatch('showMsg', {
                    content: '登录成功', type: "success"
                })
                ls.set("token", res.data)
                setTimeout(() => {
                    window.location.href = "/admin/post"
                }, 1000)
            } else {
                this.$store.dispatch('showMsg', res.message)
            }
        }
    }
github developmentseed / skynet-scrub / app / scripts / util / auto-save.js View on Github external
export function destroyLocalActions () {
  const stored = store.get(KEY);
  store.set(KEY, NULL);
  return stored === NULL ? false : stored;
}
export function saveLocalActions (actions) {
github developmentseed / skynet-scrub / app / scripts / util / auto-save.js View on Github external
export function saveLocalActions (actions) {
  store.set(KEY, actions);
  return actions;
}

store2

Better localStorage

MIT
Latest version published 9 months ago

Package Health Score

77 / 100
Full package analysis