0.0.19 • Published 4 years ago

chrome-ext-mst-sync v0.0.19

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

Overview

chrome-ext-mst-sync is a library that allows you to easily sync mobx-state-tree stores across the various Chrome extension pages(background, browser action, and content scripts).

The idea is that you have one store(in the background script) as your source of truth and any actions used on that store are synced to the listeners. However, the stores that act as listeners as used as regular MST stores.

Usage

Background script:

const { createStoreSync } = require('chrome-ext-mst-sync')
const storeId = 'mystore'
const store = MyStore.create()
const storeSync = createStoreSync(storeId, store, {
    truthStore: true
})

// start listening
storeSync.start()

Browser action script:

const { createStoreSync, getStore } = require('chrome-ext-mst-sync')
const snapshot = await getStore(storeId)
const store = MyStore.create(snapshot)
const storeSync = createStoreSync(storeId, store, {
    truthStore: false
})

// start listening
storeSync.start()

// Now we can use the store as usual and all actions will be run in the background script and synced back here
store.doSometing()
0.0.19

4 years ago

0.0.18

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.5

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago