Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
63 lines (46 sloc) 1.27 KB

Stuff for working with phantomjs from within Emacs.

Dependancies

This package requires phantomjs v1.5 to be installed. This package does no checking (yet) for that dependancy.

The location of phantomjs can be controlled with the customizaton variable:

phantomjs-home

which is expanded before being used (so you can use ~ and .. and such like).

Using

Here's some illustrative EmacsLisp:

(defun test-phantom-complete ()
  (elnode-stop 8005)
  (message "test run done"))

(let (phantom-server)
  (setq phantom-server
        (phantomjs-server
         'servertest 6101
         'test-phantom-complete))
  (sleep-for 2)
  ;; Open a url
  (phantomjs-open
   phantom-server
   "http://localhost:8005/talk/stuff/html/index.html"
   (lambda (status arg)
     (sleep-for 3)
     ;; Then exit
     (phantomjs-exit
      arg
      (lambda (status arg)
        (message "plaintalk exited phantom"))))))

It's also possible to call Javascript functions inside the opened web page. That will have to wait for an README.

Building the package

Use make to rebuild this package:

make clean all

will produce the appropriately versioned phantomjs tar file which can then be installed (locally) with:

M-x package-install-file
Something went wrong with that request. Please try again.