| 24 | this.reject = dictionary.reject; |
| 25 | } |
| 26 | callback(message /*, value, etc */) { |
| 27 | if (message < 0) { |
| 28 | this.reject(); |
| 29 | return; |
| 30 | } |
| 31 | |
| 32 | if (1 == message) |
| 33 | this.jpeg = new JPEG(); |
| 34 | else if (4 == message) |
| 35 | this.jpeg.push(this.read(ArrayBuffer)); |
| 36 | else if (5 == message) { |
| 37 | this.jpeg.push(); |
| 38 | this.resolve(); |
| 39 | } |
| 40 | |
| 41 | while (this.jpeg.ready) { |
| 42 | let block = this.jpeg.read(); |
| 43 | this.poco.begin(block.x, block.y, block.width, block.height); |
| 44 | this.poco.drawBitmap(block, block.x, block.y); |
| 45 | this.poco.end(); |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | function display(poco, host, path = "/") |