Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
18
Merge Requests
18
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
jio
Commits
4a01d505
Commit
4a01d505
authored
Dec 27, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deleteItem from pseudo localStorages renamed to removeItem + fix "null" bug
parent
2f914bc0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
10 deletions
+14
-10
src/jio.storage/localstorage.js
src/jio.storage/localstorage.js
+7
-6
src/jio/intro.js
src/jio/intro.js
+7
-4
No files found.
src/jio.storage/localstorage.js
View file @
4a01d505
...
...
@@ -15,13 +15,14 @@ var newLocalStorage = function (spec, my) {
*/
localstorage
=
{
getItem
:
function
(
item
)
{
return
JSON
.
parse
(
localStorage
.
getItem
(
item
));
var
value
=
localStorage
.
getItem
(
item
);
return
value
===
null
?
null
:
JSON
.
parse
(
value
);
},
setItem
:
function
(
item
,
value
)
{
return
localStorage
.
setItem
(
item
,
JSON
.
stringify
(
value
));
},
delet
eItem
:
function
(
item
)
{
delete
localStorage
[
item
]
;
remov
eItem
:
function
(
item
)
{
return
localStorage
.
removeItem
(
item
)
;
}
};
...
...
@@ -253,7 +254,7 @@ var newLocalStorage = function (spec, my) {
priv
.
localpath
+
"
/
"
+
command
.
getDocId
());
if
(
typeof
command
.
getAttachmentId
()
===
"
string
"
)
{
// seeking for an attachment
localstorage
.
delet
eItem
(
localstorage
.
remov
eItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
());
// remove attachment from document
...
...
@@ -281,11 +282,11 @@ var newLocalStorage = function (spec, my) {
attachment_list
.
push
(
i
);
}
}
localstorage
.
delet
eItem
(
localstorage
.
remov
eItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
());
// delete all attachments
for
(
i
=
0
;
i
<
attachment_list
.
length
;
i
+=
1
)
{
localstorage
.
delet
eItem
(
localstorage
.
remov
eItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
()
+
"
/
"
+
attachment_list
[
i
]);
}
...
...
src/jio/intro.js
View file @
4a01d505
...
...
@@ -4,12 +4,13 @@
if
(
typeof
localStorage
!==
"
undefined
"
)
{
localstorage
=
{
getItem
:
function
(
item
)
{
return
JSON
.
parse
(
localStorage
.
getItem
(
item
));
var
value
=
localStorage
.
getItem
(
item
);
return
value
===
null
?
null
:
JSON
.
parse
(
value
);
},
setItem
:
function
(
item
,
value
)
{
return
localStorage
.
setItem
(
item
,
JSON
.
stringify
(
value
));
},
delet
eItem
:
function
(
item
)
{
remov
eItem
:
function
(
item
)
{
delete
localStorage
[
item
];
},
clone
:
function
()
{
...
...
@@ -21,12 +22,14 @@
var
pseudo_localStorage
=
{};
localstorage
=
{
getItem
:
function
(
item
)
{
return
JSON
.
parse
(
pseudo_localStorage
[
item
]);
var
value
=
pseudo_localStorage
[
item
];
return
value
===
undefined
?
null
:
JSON
.
parse
(
pseudo_localStorage
[
item
]);
},
setItem
:
function
(
item
,
value
)
{
return
pseudo_localStorage
[
item
]
=
JSON
.
stringify
(
value
);
},
delet
eItem
:
function
(
item
)
{
remov
eItem
:
function
(
item
)
{
delete
pseudo_localStorage
[
item
];
},
clone
:
function
()
{
...
...
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