Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
todomvc
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
Eugene Shen
todomvc
Commits
604a76c5
Commit
604a76c5
authored
Jul 31, 2016
by
Lucas Qiu
Committed by
Sam Saccone
Jul 31, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not parse db again in store.save/remove/drop (#1657)
parent
40bada0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
examples/vanillajs/js/store.js
examples/vanillajs/js/store.js
+5
-4
No files found.
examples/vanillajs/js/store.js
View file @
604a76c5
...
...
@@ -92,7 +92,7 @@
}
localStorage
[
this
.
_dbName
]
=
JSON
.
stringify
(
data
);
callback
.
call
(
this
,
JSON
.
parse
(
localStorage
[
this
.
_dbName
]).
todos
);
callback
.
call
(
this
,
todos
);
}
else
{
// Generate an ID
updateData
.
id
=
new
Date
().
getTime
();
...
...
@@ -121,7 +121,7 @@
}
localStorage
[
this
.
_dbName
]
=
JSON
.
stringify
(
data
);
callback
.
call
(
this
,
JSON
.
parse
(
localStorage
[
this
.
_dbName
]).
todos
);
callback
.
call
(
this
,
todos
);
};
/**
...
...
@@ -130,8 +130,9 @@
* @param {function} callback The callback to fire after dropping the data
*/
Store
.
prototype
.
drop
=
function
(
callback
)
{
localStorage
[
this
.
_dbName
]
=
JSON
.
stringify
({
todos
:
[]});
callback
.
call
(
this
,
JSON
.
parse
(
localStorage
[
this
.
_dbName
]).
todos
);
var
data
=
{
todos
:
[]};
localStorage
[
this
.
_dbName
]
=
JSON
.
stringify
(
data
);
callback
.
call
(
this
,
data
.
todos
);
};
// Export to window
...
...
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