Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
simplevuestore
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Adam Procter
simplevuestore
Commits
43cfabf6
Commit
43cfabf6
authored
Apr 11, 2019
by
Adam Procter
💩
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'changes'
parents
a4e7256e
84b6c5fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletion
+28
-1
src/store.js
src/store.js
+28
-1
No files found.
src/store.js
View file @
43cfabf6
...
...
@@ -32,12 +32,38 @@ const store = new Vuex.Store({
},
actions
:
{
SYNC_DB
()
{
pouchdb
.
sync
(
remote
,
{
live
:
true
,
retry
:
true
})
// do one way, one-off sync from the server until completion
pouchdb
.
replicate
.
from
(
remote
).
on
(
'
complete
'
,
function
(
info
)
{
// then two-way, continuous, retriable sync
pouchdb
.
sync
(
remote
,
{
live
:
true
,
retry
:
true
})
.
on
(
'
change
'
,
function
(
info
)
{
// handle change
//console.log(info.change.docs[0].flavour)
store
.
commit
(
'
CHANGE_STATE
'
,
info
.
change
.
docs
[
0
].
flavour
)
})
.
on
(
'
paused
'
,
function
(
err
)
{
// replication paused (e.g. replication up to date, user went offline)
})
.
on
(
'
active
'
,
function
()
{
// replicate resumed (e.g. new changes replicating, user went back online)
})
.
on
(
'
denied
'
,
function
(
err
)
{
// a document failed to replicate (e.g. due to permissions)
})
.
on
(
'
complete
'
,
function
(
info
)
{
// handle complete
})
.
on
(
'
error
'
,
function
(
err
)
{
// handle error
})
})
},
INCOMING_CHANGE
(
_state
,
event
)
{
var
id
=
'
myfav
'
store
.
commit
(
'
CHANGE_STATE
'
,
event
)
// send change also to the pouch
pouchdb
.
get
(
'
myfav
'
)
...
...
@@ -61,6 +87,7 @@ const store = new Vuex.Store({
})
}
},
getters
:
{
currentflavour
:
state
=>
{
return
state
.
flavour
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment