jimp-dev/jimp

Clarify documentation: callback not required to create an image

開放

#957 建立於 2020年10月24日

 (1 則留言) (1 個反應) (0 位負責人)JavaScript (785 個分叉)batch import
documentationhelp wantedsolution in issue

倉庫指標

星標
 (13,218 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

The documentation says:

Iyou want to begin with an empty Jimp image, you can call the Jimp constructor passing the width and height of the image to create and a Node-style callback:

 new Jimp(256, 256, (err, image) => {
  // this image is 256 x 256, every pixel is set to 0x00000000
});

However, it works fine to not pass the callback:

const image = new Jimp(256, 256);

Not sure if both options are valid, but it would have made my code simpler from the start if I realised I didn't need the callback.

貢獻者指南