-
-
Save drcmda/0ac6584d775203a9d81b to your computer and use it in GitHub Desktop.
awv3.es2015, stage-0 async/await
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Canvas from 'canvas'; | |
import * as parser from 'parser'; | |
let canvas = new Canvas({ | |
dom: document.querySelector('#main') | |
}); | |
let blob = {command: "Blob", data: "GQaÉPB3*Ì¥Jj5£D)3.cF¼´NE0©«p|S·D©t¨0;07BpÎÌFC·63.©S¢WkÍÀÄ^gg6ÁP£9Ä$xÃmÊ·¢|cÆ!º%~ÆWa[¼MsLÅmxÊv}oN¡qL.ÆƤZ!Iu¤6Z2UµPxVx,°¤¢«O²¤¹H=¡l´.¼o~Ãh]À3·]q·lc6:{}TÁuC¡¢1^·QP¥AG¸ÎËJ¸R¨Á¨M(®MÌBK1B|t³ËZ@²l§9Âv®M7%Ev¡@vB¨ÂP¸¦ZL¿MSr66[§Ã¯F%=q¨KNCf$N½9_xQ*§goÃb7dµ4¼²W~7h}2duNJW*U¤À4±È=¨XF2Ì¢FfInP¡H¼JºUÈ._¡²L7¼]GD±Ç¿¼;«dVAM[F«]VÎË#g%´¾Ä¸¸a3ËavÄ$¼Fzz®Q¡¸®_Â}¸»k¢Pc¹:@Ì6¢D1G©$cz:1S~O6ËqI³S¥@XM©Olw%f@w·GÃLÆ¥³qzQIGA5¨@r¶FDUL¢¥T¥3¼^aHzoºÍW][OH³gdÇ)!", length: 1093}; | |
// Add views, etc. | |
function treat(result) { | |
// Add models to scene, etc ... | |
return result; | |
} | |
async function parseBlobs() { | |
let results = []; | |
results.push(await parser.parse(blob).then(treat)) | |
console.log("1st") | |
results.push(await parser.parse(blob).then(treat)) | |
console.log("2nd") | |
results.push(await parser.parse(blob).then(treat)) | |
console.log("3rd") | |
return results; | |
} | |
parseBlobs().then(context => console.log(context)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment