Typescript declaration for global function

孤者浪人 提交于 2021-02-08 04:58:06

问题


I am trying to use image loading third party plugin blueimp. That plugin has global function

loadImage(
    e.target.files[0],
    function (img) {
        document.body.appendChild(img);
    },
    { maxWidth: 600 }
);

How can I call this function using typescript?


回答1:


You can put the following line before the function call:

declare var loadImage;

[Playground]



来源:https://stackoverflow.com/questions/34395615/typescript-declaration-for-global-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!