| Line 25: |
Line 25: |
| | } | | } |
| | | | |
| − | var queueshelf = {}; | + | this.EnqueueWB = async function( idk ) { |
| − | this.wbqueue = function(id) { | + | var k = await wbqueue(idk); |
| − | if ( typeof queueshelf[id] != undefined ) { | + | return k; |
| − | $.getJSON('/w/api.php?action=wbgetentities&format=json&ids=' + id, function(json) {
| + | } |
| − | var h = json.entities;
| + | |
| − | queueshelf[id] = h;
| + | async function wbqueue(id) { |
| − | return h; | + | return new Promise( |
| − | }) | + | function(resolve, reject) { |
| − | } else {
| + | $.getJSON('/w/api.php?action=wbgetentities&format=json&ids=' + id, function(json) { |
| − | console.log("getting from store");
| + | var h = json.entities; |
| − | return queueshelf[id];
| + | resolve(h); |
| − | }
| + | }) |
| | + | }).then( function(result) { |
| | + | console.log(result); |
| | + | return result; |
| | + | }); |
| | } | | } |
| | | | |