weixin_39938312
weixin_39938312
2020-12-09 07:18

Add support for toDataURL

This fixes an issue I was having using this library, where we call canvas.toDataURL in one of our react components.

I've used an empty string, but we can optionally go for a valid image (1x1 spacer), so the output is a valid image:


data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7

Thanks for the library :heart:

该提问来源于开源项目:hustcc/jest-canvas-mock

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

7条回答

  • weixin_39629969 weixin_39629969 5月前

    Coverage Status

    Coverage remained the same at 100.0% when pulling 4a3a33aa850dc209fbf71b2af49da80bcd787279 on AdrianSchneider:support-toDataURL into 5d5ef9b1bdc8853450825fb7cd80d2bbd3b3139e on hustcc:master.

    点赞 评论 复制链接分享
  • weixin_39703773 weixin_39703773 5月前

    Function toDataURL should be on canvas instance, not Context2d.

    点赞 评论 复制链接分享
  • weixin_39938312 weixin_39938312 5月前

    Fixed, sorry about that. My local test (integrated with an app) had another fix for it that gave me a false positive. Should be good now. :+1:

    点赞 评论 复制链接分享
  • weixin_39703773 weixin_39703773 5月前

    Thank you very much. Will publish soon.

    点赞 评论 复制链接分享
  • weixin_39703773 weixin_39703773 5月前

    v1.0.2 released.

    点赞 评论 复制链接分享
  • weixin_39629969 weixin_39629969 5月前

    Coverage Status

    Coverage remained the same at 100.0% when pulling b5a6219c49e8f611e74cc0c07e8de982a9435f70 on AdrianSchneider:support-toDataURL into 5d5ef9b1bdc8853450825fb7cd80d2bbd3b3139e on hustcc:master.

    点赞 评论 复制链接分享
  • weixin_39629969 weixin_39629969 5月前

    Coverage Status

    Coverage remained the same at 100.0% when pulling b5a6219c49e8f611e74cc0c07e8de982a9435f70 on AdrianSchneider:support-toDataURL into 5d5ef9b1bdc8853450825fb7cd80d2bbd3b3139e on hustcc:master.

    点赞 评论 复制链接分享

相关推荐