如何在meteor中使用webshot [英] How to use webshot with meteor

查看:46
本文介绍了如何在meteor中使用webshot的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从以下位置安装了 webshot 包和meteor webshot 智能包:https://github.com/TimHeckel/meteor-webshot

I've installed webshot package and meteor webshot smart package from: https://github.com/TimHeckel/meteor-webshot

在目录 pacages/webshot/lib/webshot.js 中有 WEBSHOT 对象的定义.在默认的流星应用程序中,我想使用这个对象来获取快照,如上面链接的第二步所示:

In the directory pacages/webshot/lib/webshot.js there is definition of WEBSHOT object. In the default meteor application I want to use this object to get the snapshot as show in the second step from the link above:

Template.hello.events({
'click input' : function () {
  var _image = "myscreenshot.png";
  var _res =  WEBSHOT.snap("http://google.com", "public/exports~/" + _image, {
    screenSize: {
        width: 300
        , height: 300
      }
    });

}

});

当我点击按钮时出现异常:未捕获的 ReferenceError:未定义 WEBSHOT.

When I click on the button I have an exception: Uncaught ReferenceError: WEBSHOT is not defined.

命令:

流星列表

显示 webshot 包,我需要在哪里包含此包才能使其正常工作?

show webshot package, where do I need to include this package to get this working?

推荐答案

我遇到了同样的问题,所以我使用最新版本的 node-webshot 添加了一个新的 Meteor 包装器:https://atmospherejs.com/bryanmorgan/webshot.

I had the same problem so I added a new Meteor wrapper using the latest version of node-webshot: https://atmospherejs.com/bryanmorgan/webshot.

您应该能够使用:

meteor add bryanmorgan:webshot

然后是与 node-webshot 相同的 API:

And then the same API as node-webshot:

webshot("http://google.com", "/tmp/google.png", function (err) {
    // screenshot saved to /tmp/google.png
});

这篇关于如何在meteor中使用webshot的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆