Closed Sayum24 closed 2 years ago
Found this way to print in the program: Make the function which calls the function to draw the Image into a async function.
const term = require('terminal-kit').terminal;
const getPixels = require("get-pixels")
test();
async function drawImage() {
await term.drawImage("logo.png", {
shrink: {
width: 50,
height: 50
}
}, )
return;
}
async function test(){
console.log('before')
await drawImage();
console.log('after')
}
Is this the only way to make this happen?
@Sayum24 From the doc, you'll see that .drawImage() is not sync. You have to pass a callback (old API) OR await for the returning promise.
In Javascript, async/await/promise are very common concept you should be familiar with.
When I want to draw an Image I want to stop the program, until the image is finished.
This code prints first
Test123
and then starts to print the image. How can I change that?