本文整理匯總了TypeScript中image-diff.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: Promise
return new Promise(resolve => {
imageDiff({
actualImage: actualPath,
expectedImage: goldenPath,
diffImage: diffPath,
}, (err: any, imagesAreEqual: boolean) => {
if (err) {
throw err;
}
resolve(imagesAreEqual);
});
});
示例2: Promise
return new Promise((resolve: any, reject: any) => {
imageDiff({
actualImage: pullRequestUrl,
expectedImage: goldUrl,
diffImage: diffUrl,
}, (err: any, imagesAreSame: boolean) => {
if (err) {
console.log(err);
imagesAreSame = false;
reject(err);
}
resolve(imagesAreSame);
return updateFileResult(database, prNumber, filenameKey, imagesAreSame);
});
});
示例3: compareImages
export function compareImages (img1: string, img2: string, cb: Function = () => {}) {
// console.log(`comparing
// ../../results/screenshots/ ${img1}
// ../../results/screenshots/ ${img2}`);
imageDiff({
actualImage: `${ssDir}/${img1}.png`,
expectedImage: `${ssDir}/${img2}.png`,
diffImage: `${ssDir}/COMPARE:${img1}+${img2}.png`
}, (err, imagesAreSame) => {
cb(imagesAreSame);
});
// fs.readFile(`../../results/screenshots/${img1}.png`, 'utf8', () => console.log("callback"));
// resemble(`./results/screenshots/${img1}.png`).compareTo(`./results/screenshots/${img2}.png`).ignoreColors().onComplete(data => {
// console.log('compare data ', data);
// return cb(data);
// })
}