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
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) {
...
@@ -15,13 +15,14 @@ var newLocalStorage = function (spec, my) {
*/
*/
localstorage
=
{
localstorage
=
{
getItem
:
function
(
item
)
{
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
)
{
setItem
:
function
(
item
,
value
)
{
return
localStorage
.
setItem
(
item
,
JSON
.
stringify
(
value
));
return
localStorage
.
setItem
(
item
,
JSON
.
stringify
(
value
));
},
},
delet
eItem
:
function
(
item
)
{
remov
eItem
:
function
(
item
)
{
delete
localStorage
[
item
]
;
return
localStorage
.
removeItem
(
item
)
;
}
}
};
};
...
@@ -253,7 +254,7 @@ var newLocalStorage = function (spec, my) {
...
@@ -253,7 +254,7 @@ var newLocalStorage = function (spec, my) {
priv
.
localpath
+
"
/
"
+
command
.
getDocId
());
priv
.
localpath
+
"
/
"
+
command
.
getDocId
());
if
(
typeof
command
.
getAttachmentId
()
===
"
string
"
)
{
if
(
typeof
command
.
getAttachmentId
()
===
"
string
"
)
{
// seeking for an attachment
// seeking for an attachment
localstorage
.
delet
eItem
(
localstorage
.
remov
eItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
()
+
"
/
"
+
priv
.
localpath
+
"
/
"
+
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
());
command
.
getAttachmentId
());
// remove attachment from document
// remove attachment from document
...
@@ -281,11 +282,11 @@ var newLocalStorage = function (spec, my) {
...
@@ -281,11 +282,11 @@ var newLocalStorage = function (spec, my) {
attachment_list
.
push
(
i
);
attachment_list
.
push
(
i
);
}
}
}
}
localstorage
.
delet
eItem
(
localstorage
.
remov
eItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
());
priv
.
localpath
+
"
/
"
+
command
.
getDocId
());
// delete all attachments
// delete all attachments
for
(
i
=
0
;
i
<
attachment_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
attachment_list
.
length
;
i
+=
1
)
{
localstorage
.
delet
eItem
(
localstorage
.
remov
eItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
()
+
"
/
"
+
priv
.
localpath
+
"
/
"
+
command
.
getDocId
()
+
"
/
"
+
attachment_list
[
i
]);
attachment_list
[
i
]);
}
}
...
...
src/jio/intro.js
View file @
4a01d505
...
@@ -4,12 +4,13 @@
...
@@ -4,12 +4,13 @@
if
(
typeof
localStorage
!==
"
undefined
"
)
{
if
(
typeof
localStorage
!==
"
undefined
"
)
{
localstorage
=
{
localstorage
=
{
getItem
:
function
(
item
)
{
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
)
{
setItem
:
function
(
item
,
value
)
{
return
localStorage
.
setItem
(
item
,
JSON
.
stringify
(
value
));
return
localStorage
.
setItem
(
item
,
JSON
.
stringify
(
value
));
},
},
delet
eItem
:
function
(
item
)
{
remov
eItem
:
function
(
item
)
{
delete
localStorage
[
item
];
delete
localStorage
[
item
];
},
},
clone
:
function
()
{
clone
:
function
()
{
...
@@ -21,12 +22,14 @@
...
@@ -21,12 +22,14 @@
var
pseudo_localStorage
=
{};
var
pseudo_localStorage
=
{};
localstorage
=
{
localstorage
=
{
getItem
:
function
(
item
)
{
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
)
{
setItem
:
function
(
item
,
value
)
{
return
pseudo_localStorage
[
item
]
=
JSON
.
stringify
(
value
);
return
pseudo_localStorage
[
item
]
=
JSON
.
stringify
(
value
);
},
},
delet
eItem
:
function
(
item
)
{
remov
eItem
:
function
(
item
)
{
delete
pseudo_localStorage
[
item
];
delete
pseudo_localStorage
[
item
];
},
},
clone
:
function
()
{
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