Skip to content

Instantly share code, notes, and snippets.

@wision
Created June 20, 2014 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wision/7714928124b27db3b055 to your computer and use it in GitHub Desktop.
Save wision/7714928124b27db3b055 to your computer and use it in GitHub Desktop.
WebPage = require 'webpage'
msgHandler = (logObject, typex) ->
(msg, trace) ->
return console.log 'msgx', typex
x = typex
console.log 'typex', typex
msgStack = msg
if trace?.length
msgStack = [msgStack]
msgStack.push 'TRACE:'
for t in trace
msgStack.push " -> #{t.file || t.sourceURL}:#{t.line} #{t.function}"
#logObject[typex] ?= []
true
msgHandler2 = (logObject, typex) ->
(msg, trace) ->
return console.log 'msgx', typex
x = typex
console.log 'typex', typex
msgStack = msg
if trace?.length
msgStack = [msgStack]
msgStack.push 'TRACE:'
for t in trace
msgStack.push " -> #{t.file || t.sourceURL}:#{t.line} #{t.function}"
#logObject[typex] ?= []
true
page = WebPage.create()
logObject = {}
page.onConsoleMessage = msgHandler logObject, "pageMessage"
page.onError = msgHandler logObject, "pageError"
page.open 'http://www.travelandleisure.com/travel-blog/carry-on/topic/news/the-view-from-shangri-las-new-london-hotel?xid=blog_20140617_26091936'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment