emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] how to evaluate javascript in code blocks


From: Thomas S. Dye
Subject: Re: [O] how to evaluate javascript in code blocks
Date: Tue, 01 Jan 2013 19:13:29 -1000

dougie smith <address@hidden> writes:
> i have installed nodejs
> not sure what to do next
>
> do i need an 'ob.javascript file?
>
> can't seem to find any docs.

AFAIK, the only documentation is in the file ob-js.el.  Back in 2011,
Eric Schulte welcomed patches to ob-js.el to support sessions with
node.  I don't think there has been any subsequent work on this front.

You'll need something like this in .emacs:

(org-babel-do-load-languages
 'org-babel-load-languages
 '((js . t)))

If you evaluate the following source code block, you can look at
localhost:8888 and see Hello World.  But, emacs is fully engaged until
you press Ctrl-G.

#+begin_src js :tangle hello.js
var http = require("http");

http.createServer(function(request, response) {
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.write("Hello World");
  response.end();
}).listen(8888);
#+end_src

hth,
Tom
-- 
Thomas S. Dye
http://www.tsdye.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]