weixin_39909212
weixin_39909212
2021-01-10 04:12

How can I add error by todataurl

kineticjs have callback but How can I add error

stage.toDataURL({ callback: function (dataUrl) { alert(dataUrl) }, error:function(er) { alert(er) } });

该提问来源于开源项目:ericdrowell/KineticJS

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

4条回答

  • weixin_39706441 weixin_39706441 4月前

    What kind of error you are expecting there?

    点赞 评论 复制链接分享
  • weixin_39909212 weixin_39909212 4月前

    orginal code

    stage.toDataURL({ callback: function (dataUrl) { alert(dataUrl) });

    I want to add error

    stage.toDataURL({ callback: function (dataUrl) { alert(dataUrl) }, error:function(er) { alert(er)}});

    How to add code to an error in the kinetic part

    example $.ajax({ type: 'POST', cache: false, url:url, contentType: 'application/json; charset=utf-8',
    success: function (myresult) {
    }, error: function (xhr, textStatus, error) { console.log(xhr.statusText + '' + textStatus + '' + error);

    
        }
    });
    
    点赞 评论 复制链接分享
  • weixin_39706441 weixin_39706441 4月前

    Emmm... You want to add error, right? Are you sure? Do not do this! Any program already have a lot of bugs. ajax have error callback because many things may happen: wrong url, no network etc. stage.toDataURL is local function. And it should not have any errors. But if it will it is just KineticJS bug.

    点赞 评论 复制链接分享
  • weixin_39909212 weixin_39909212 4月前

    emmm ok thank you

    点赞 评论 复制链接分享