'crxel' is an interface of Google Chrome Extensions API for Emacs Lisp.
git clone https://github.com/ahyatt/emacs-websocket
git clone https://github.com/mechairoi/crxel
- Visit chrome://extensions in your browser.
- Ensure that the Developer Mode checkbox is checked.
- Click Load unpacked extension… and select
/path/to/crxel/crxel.crx
;; ~/.emacs.d/
(add-to-list 'load-path "/path/to/emacs-websocket")
(add-to-list 'load-path "/path/to/crxel")
(require 'crxel)
(crxel/start 9649)
;; Evaluate "1+1" in javascript and `print` the outome "2"
(crxel/eval "1+1" :success 'print :fail 'error)
or
;; Call asynchronous API `chrome.tabs.query`
;; and return the outcome by `window.crxel.callback`
(crxel/eval "var callback = window.crxel.callback;
chrome.tabs.query({}, function(tabs) {
callback(JSON.stringify(tabs));
});"
:async t
:success (lambda (data)
(print (json-read-from-string data)))
:fail 'error)