ondemand.js (519B)
1 const window = self; 2 3 self.importScripts( 4 'moolb.js', 5 'driver.js', 6 'sync.js', 7 'web3.min.js', 8 ); 9 10 onmessage = function(o) { 11 const filters = [ 12 bloomFromBytes(o.data.filters[0], o.data.filter_rounds), 13 bloomFromBytes(o.data.filters[1], o.data.filter_rounds), 14 ]; 15 const w3 = new Web3(o.data.w3_provider); 16 17 const callback = (o) => { 18 this.postMessage(o); 19 }; 20 const s = new Driver(w3, o.data.lo, filters, sync_by_filter, callback); 21 let hi = undefined; 22 if (o.data.hi > 0) { 23 hi = o.data.hi; 24 } 25 s.start(hi); 26 };