Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Clearing namespaces with IDBWrapper

a guest Feb 27th, 2014 94 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. function clearBranch(branch) {
  2.         if (typeof branch === 'undefined' || branch === null)
  3.                 branch = '';
  4.         branch = String(branch);
  5.         var options = {
  6.                 onEnd: function() {
  7.                         console.log('branch "' + branch + '" cleared');
  8.                 },
  9.                 writeAccess: true
  10.         };
  11.         if (branch !== '') {
  12.                 options.keyRange = idbStore.makeKeyRange({
  13.                         lower: branch + '.', // charCode 46
  14.                         upper: branch + '/', // charCode 47
  15.                         excludeUpper: true
  16.                 });
  17.         }
  18.         idbStore.iterate(function(item, cursor) {
  19.                 cursor.delete();
  20.         }, options);
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top