Skip to content

Conversation

@wiliam-paradox
Copy link

In electron ^2.0.0 method image .toPng is called .toPNG
see: https://github.com/electron/electron/blob/master/docs/api/native-image.md#imagetopngoptions

@kamthamc
Copy link

Can anyone please review this PR? its stopping from upgrading to newer versions of electron.

done(null, img.toPNG());

} else {
done(new Error('no png method found in electrons image.'));
Copy link

@wojtekmaj wojtekmaj Sep 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's what we have package.json for is to be sure this will never happen.

So, we could have it in one line:

const toPng = img.toPng || img.toPNG;
done(null, toPng());

If you really think that's necessary, between line 1 and 2 you could add

if (!toPng) {
    done(new Error('Neither toPng nor toPNG method was found in Electron\'s image.'));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants