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
e6a50e62
Commit
e6a50e62
authored
Apr 02, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add include_docs option management
parent
0d397a26
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
src/jio.storage/indexeddbstorage.js
src/jio.storage/indexeddbstorage.js
+14
-7
No files found.
src/jio.storage/indexeddbstorage.js
View file @
e6a50e62
...
@@ -364,7 +364,7 @@
...
@@ -364,7 +364,7 @@
};
};
// XXX doc string
// XXX doc string
IndexedDBStorage
.
prototype
.
getList
=
function
()
{
IndexedDBStorage
.
prototype
.
getList
=
function
(
option
)
{
var
rows
=
[],
onCancel
,
open_req
=
indexedDB
.
open
(
this
.
_database_name
);
var
rows
=
[],
onCancel
,
open_req
=
indexedDB
.
open
(
this
.
_database_name
);
return
new
Promise
(
function
(
resolve
,
reject
,
notify
)
{
return
new
Promise
(
function
(
resolve
,
reject
,
notify
)
{
open_req
.
onerror
=
function
()
{
open_req
.
onerror
=
function
()
{
...
@@ -388,11 +388,18 @@
...
@@ -388,11 +388,18 @@
var
cursor
=
index_req
.
result
,
now
;
var
cursor
=
index_req
.
result
,
now
;
if
(
cursor
)
{
if
(
cursor
)
{
// Called for each matching record.
// Called for each matching record.
if
(
option
.
include_docs
)
{
rows
.
push
({
rows
.
push
({
"
id
"
:
cursor
.
value
.
_id
,
"
id
"
:
cursor
.
value
.
_id
,
"
doc
"
:
cursor
.
value
,
"
doc
"
:
cursor
.
value
,
"
value
"
:
{}
"
value
"
:
{}
});
});
}
else
{
rows
.
push
({
"
id
"
:
cursor
.
value
.
_id
,
"
value
"
:
{}
});
}
now
=
Date
.
now
();
now
=
Date
.
now
();
if
(
date
<=
now
-
1000
)
{
if
(
date
<=
now
-
1000
)
{
notify
({
"
loaded
"
:
rows
.
length
});
notify
({
"
loaded
"
:
rows
.
length
});
...
@@ -421,7 +428,7 @@
...
@@ -421,7 +428,7 @@
IndexedDBStorage
.
prototype
.
allDocs
=
function
(
command
,
param
,
option
)
{
IndexedDBStorage
.
prototype
.
allDocs
=
function
(
command
,
param
,
option
)
{
/*jslint unparam: true */
/*jslint unparam: true */
this
.
createDBIfNecessary
().
this
.
createDBIfNecessary
().
then
(
this
.
getList
.
bind
(
this
)).
then
(
this
.
getList
.
bind
(
this
,
option
)).
then
(
command
.
success
,
command
.
error
,
command
.
notify
);
then
(
command
.
success
,
command
.
error
,
command
.
notify
);
};
};
...
...
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