forked from assaf/zombie
/
index.coffee
41 lines (36 loc) · 1.24 KB
/
index.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
zombie = require("./browser")
# Constructor for a new Browser. Takes no arguments.
exports.Browser = zombie.Browser
exports.package = zombie.package
exports.version = zombie.version
# ### zombie.visit(url, callback)
# ### zombie.visit(url, options, callback)
#
# Creates a new Browser, opens window to the URL and calls the callback when
# done processing all events.
#
# For example:
# zombie = require("zombie")
#
# vows.describe("Brains").addBatch(
# "seek":
# topic: ->
# zombie.browse "http://localhost:3000/brains", @callback
# "should find": (browser)->
# assert.ok browser.html("#brains")[0]
# ).export(module);
#
# * url -- URL of page to open
# * options -- Initialize the browser with these options
# * callback -- Called with error, browser
exports.visit = (url, options, callback)->
new zombie.Browser(options).visit(url, options, callback)
# ### listen port, callback
# ### listen socket, callback
# ### listen callback
#
# Ask Zombie to listen on the specified port for requests. The default
# port is 8091, or you can specify a socket name. The callback is
# invoked once Zombie is ready to accept new connections.
exports.listen = (port, callback)->
require("./protocol").listen(port, callback)