Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio_mebibou
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
Alexandra Rogova
jio_mebibou
Commits
2d7fccfc
Commit
2d7fccfc
authored
Apr 03, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
useless methods removed
parent
5a302480
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
158 deletions
+0
-158
src/jio.storage/indexeddbstorage.js
src/jio.storage/indexeddbstorage.js
+0
-158
No files found.
src/jio.storage/indexeddbstorage.js
View file @
2d7fccfc
...
@@ -123,164 +123,6 @@
...
@@ -123,164 +123,6 @@
});
});
};
};
// XXX doc string
IndexedDBStorage
.
prototype
.
getMetadata
=
function
(
id
)
{
var
onCancel
,
open_req
=
indexedDB
.
open
(
this
.
_database_name
);
return
new
Promise
(
function
(
resolve
,
reject
)
{
open_req
.
onerror
=
function
()
{
if
(
open_req
.
result
)
{
open_req
.
result
.
close
();
}
reject
(
open_req
.
error
);
};
open_req
.
onsuccess
=
function
()
{
// *Called at t + 1*
var
tx
,
store
,
get_req
,
err
,
res
,
db
=
open_req
.
result
;
try
{
db
.
onerror
=
function
()
{
db
.
close
();
};
tx
=
db
.
transaction
(
"
metadata
"
,
"
readonly
"
);
// `db.transaction` can throw an error
tx
.
onerror
=
function
()
{
reject
(
err
||
tx
.
error
);
db
.
close
();
};
tx
.
oncomplete
=
function
()
{
// *Called at t + 3*
if
(
err
)
{
reject
(
err
);
}
else
{
resolve
(
res
);
}
db
.
close
();
};
// we can cancel the transaction from here
onCancel
=
function
()
{
tx
.
abort
();
db
.
close
();
};
store
=
tx
.
objectStore
(
"
metadata
"
);
get_req
=
store
.
get
(
id
);
get_req
.
onabort
=
function
()
{
// if cancelled, the get_req should fail
// and I hope the tx.onerror is called
err
=
get_req
.
error
;
};
get_req
.
onerror
=
get_req
.
onabort
;
get_req
.
onsuccess
=
function
()
{
// *Called at t + 2*
// if cancelled, this listener should not be called
if
(
!
get_req
.
result
)
{
err
=
"
not_found
"
;
return
;
}
res
=
get_req
.
result
;
};
}
catch
(
e
)
{
reject
(
e
);
db
.
close
();
}
};
},
function
()
{
if
(
typeof
onCancel
===
"
function
"
)
{
onCancel
();
}
});
};
// XXX doc string
IndexedDBStorage
.
prototype
.
putMetadata
=
function
(
metadata
)
{
var
onCancel
,
open_req
=
indexedDB
.
open
(
this
.
_database_name
);
return
new
Promise
(
function
(
resolve
,
reject
)
{
open_req
.
onerror
=
function
()
{
if
(
open_req
.
result
)
{
open_req
.
result
.
close
();
}
reject
(
open_req
.
error
);
};
open_req
.
onsuccess
=
function
()
{
// *Called at t + 1*
var
tx
,
store
,
db
=
open_req
.
result
;
try
{
tx
=
db
.
transaction
(
"
metadata
"
,
"
readwrite
"
);
tx
.
onerror
=
function
()
{
reject
(
tx
.
error
);
db
.
close
();
};
tx
.
oncomplete
=
function
()
{
// *Called at t + 3*
resolve
();
db
.
close
();
};
// we can cancel the transaction from here
onCancel
=
function
()
{
tx
.
abort
();
db
.
close
();
};
store
=
tx
.
objectStore
(
"
metadata
"
);
store
.
put
(
metadata
);
// store.onsuccess = function () {
// // *Called at t + 2*
// };
}
catch
(
e
)
{
reject
(
e
);
db
.
close
();
}
};
},
function
()
{
if
(
typeof
onCancel
===
"
function
"
)
{
onCancel
();
}
});
};
// XXX doc string
IndexedDBStorage
.
prototype
.
removeMetadata
=
function
(
id
)
{
var
onCancel
,
open_req
=
indexedDB
.
open
(
this
.
_database_name
);
return
new
Promise
(
function
(
resolve
,
reject
)
{
open_req
.
onerror
=
function
()
{
if
(
open_req
.
result
)
{
open_req
.
result
.
close
();
}
reject
(
open_req
.
error
);
};
open_req
.
onsuccess
=
function
()
{
// *Called at t + 1*
var
tx
,
store
,
db
=
open_req
.
result
;
try
{
tx
=
db
.
transaction
(
"
metadata
"
,
"
readwrite
"
);
tx
.
onerror
=
function
()
{
reject
(
tx
.
error
);
db
.
close
();
};
tx
.
oncomplete
=
function
()
{
// *Called at t + 3*
resolve
();
db
.
close
();
};
// we can cancel the transaction from here
onCancel
=
function
()
{
tx
.
abort
();
db
.
close
();
};
store
=
tx
.
objectStore
(
"
metadata
"
);
store
[
"
delete
"
](
id
);
// store.onsuccess = function () {
// // *Called at t + 2*
// };
}
catch
(
e
)
{
reject
(
e
);
db
.
close
();
}
};
},
function
()
{
if
(
typeof
onCancel
===
"
function
"
)
{
onCancel
();
}
});
};
// XXX doc string
IndexedDBStorage
.
prototype
.
removeAttachments
=
function
(
id
,
attachment_ids
)
{
/*jslint unparam: true */
return
new
Promise
(
function
(
done
)
{
done
();
});
};
// XXX doc string
// XXX doc string
IndexedDBStorage
.
prototype
.
get
=
function
(
command
,
param
)
{
IndexedDBStorage
.
prototype
.
get
=
function
(
command
,
param
)
{
var
shared
=
{
"
connector
"
:
this
};
var
shared
=
{
"
connector
"
:
this
};
...
...
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