为什么Phantom,Casper和Meteor需要它们自己的可执行文件? [英] Why do Phantom, Casper, and Meteor need their own executables?

查看:114
本文介绍了为什么Phantom,Casper和Meteor需要它们自己的可执行文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Phantom 和Meteor是在Node的基础上构建的,而Casper是在Phantom的基础上构建的.为什么它们每个人都需要各自独立的可执行文件,而不是通过Node.js require的库?

Phantom and Meteor are built off Node, and Casper is built off Phantom. Why do they each need their own separate executable, rather than being libraries you require through Node.js?

(我发现它使它们更难使用,尤其是在Windows上.)

(I find it makes them harder to work with, especially on Windows.)

推荐答案

phantomjs与节点完全分开:

phantomjs is completely separate from node:

http://phantomjs.org/faq.html

问:为什么PhantomJS不写为Node.js模块?

Q: Why is PhantomJS not written as Node.js module?

A:简短的回答:没有人可以担任两个主人."

A: The short answer: "No one can serve two masters."

更长的解释如下.

到目前为止,这样做在技术上非常具有挑战性.

As of now, it is technically very challenging to do so.

每个Node.js模块本质上都是Node.js核心的从属",即主".在目前状态下,PhantomJS(及其随附的WebKit)需要对所有内容(事件循环,网络堆栈和JavaScript执行)具有完全控制(以同步方式).

Every Node.js module is essentially "a slave" to the core of Node.js, i.e. "the master". In its current state, PhantomJS (and its included WebKit) needs to have the full control (in a synchronous matter) over everything: event loop, network stack, and JavaScript execution.

如果意图是直接在Node.js中运行的脚本中使用PhantomJS,则可以通过启动PhantomJS进程并与其进行交互来实现这种松散绑定".

If the intention is just about using PhantomJS right from a script running within Node.js, such a "loose binding" can be achieved by launching a PhantomJS process and interact with it.

CasperJS构建在节点之上,因此它本身显然不是节点模块.尽管在这种情况下,您可以在节点上使用 SpookyJS .

CasperJS is built on top of node, so it obviously isn't a node module by itself. Although in that case, you can use SpookyJS with node.

流星确实应该更紧密地与节点耦合.有一个类似的框架 Derby 可以用作模块.

Meteor really should be more tightly coupled with node. There's a similar framework Derby built for use as a module.

这篇关于为什么Phantom,Casper和Meteor需要它们自己的可执行文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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