Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio-main
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hardik Juneja
jio-main
Commits
0747228c
Commit
0747228c
authored
Dec 24, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
localstorage.js put method redesigned
parent
881a6994
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
16 deletions
+15
-16
src/jio.storage/localstorage.js
src/jio.storage/localstorage.js
+15
-16
No files found.
src/jio.storage/localstorage.js
View file @
0747228c
...
...
@@ -105,27 +105,26 @@ var newLocalStorage = function (spec, my) {
/**
* Create or update a document in local storage.
* @method
_
put
* @method put
* @param {object} command The JIO command
*
* Available options:
* - {boolean} conflicts Add a conflicts object to the response
* - {boolean} revs Add the revisions history of the document
* - {boolean} revs_info Add revisions informations
*
*/
that
.
_
put
=
function
(
command
)
{
that
.
put
=
function
(
command
)
{
setTimeout
(
function
()
{
var
docid
=
command
.
getDocId
(),
path
=
'
jio/local/
'
+
priv
.
username
+
'
/
'
+
priv
.
applicationname
+
'
/
'
+
docid
,
doc
=
localstorage
.
getItem
(
path
);
if
(
!
doc
)
{
that
.
success
(
priv
.
setDocument
(
command
,
'
post
'
));
var
doc
;
doc
=
localstorage
.
getItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
());
if
(
typeof
doc
===
"
undefined
"
)
{
// the document does not exists
doc
=
command
.
cloneDoc
();
}
else
{
that
.
success
(
priv
.
documentUpdate
(
command
,
'
put
'
));
// the document already exists
priv
.
documentObjectUpdate
(
doc
,
command
.
getDocId
());
}
// write
localstorage
.
setItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
(),
doc
);
that
.
success
({
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()});
});
};
...
...
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