pismo icon indicating copy to clipboard operation
pismo copied to clipboard

Problem with (CoffeeScript) Code

Open travisjeffery opened this issue 13 years ago • 0 comments

Hello,

I was just trying to use Pismo on a webpage with this syntax code in the article:

sys:   require 'sys'
http:  require 'http'
client: http.createClient 8080, 'localhost'
# start an active chain gang queue with 3 workers by default.
chain: require('chain-gang').create()

# downloads a web page, runs the callback when it's done.
get_path: (path, cb) ->
  req: client.request('GET', path, {host: 'localhost'})
  req.end()
  req.addListener 'response', (resp) ->
    resp.addListener 'data', (chunk) ->
      sys.puts chunk
    resp.addListener 'end', cb

# returns a chain gang job that downloads a web page and finishes the worker.
job: (timeout, name) ->
  (worker) ->
    get_path "/$timeout/$name", ->
      worker.finish()

But it came out as:

'sys'
'http'
'localhost'
# start an active chain gang queue with 3 workers by default.
'chain-gang'
# downloads a web page, runs the callback when it's done.
'GET'
'localhost'
'response'
'data'
'end'
# returns a chain gang job that downloads a web page and finishes the worker.
"/$timeout/$name"

'foo'
# queues the job with the unique name "foo_request"
'foo'
'foo_request'

When I ran html_body. :(

travisjeffery avatar Jun 05 '11 02:06 travisjeffery