   phantom.exit 1
 
 page.onLoadFinished = (status) ->
-  loaded = page.evaluate(->
-    !!document.body
-  )
+  loaded = page.evaluate -> !!document.body
   setTimeout render, 300  if status is "success" or loaded is true
 
 page.open url

      height: height

    result.height = height
    result.width = width

  result.imageData = page.renderBase64(format)
  result.format = format
  console.log JSON.stringify(result)
  phantom.exit()



render = ->
  result = page.evaluate ->
    result = {}

    result.title          = document.title if document?.title?

    if false # debug
      result.documentWidth  = document.width if document?.width?
      result.documentHeight = document.height if document?.height?
      result.innerWidth     = window.innerWidth if window?.innerWidth?
      result.innerHeight    = window.innerHeight if window?.innerHeight?
      result.clientWidth    = document.body.clientWidth if document?.body?.clientWidth?
      result.clientHeight   = document.body.clientHeight if document?.body?.clientHeight?

    result

  if crop and width > 0 and height > 0
    # Cropping isn't exactly what we want, but PhantomJS does
    # not yet have a "window size" concept (See NOTE above).
    page.clipRect =
