2012-05-12 04:32:16 +04:00
|
|
|
p = require("webpage").create()
|
|
|
|
p.onConsoleMessage = (msg) ->
|
|
|
|
console.log msg
|
|
|
|
|
|
|
|
p.onCallback = (msg) ->
|
|
|
|
console.log "Received by the 'phantom' main context: " + msg
|
|
|
|
"Hello there, I'm coming to you from the 'phantom' context instead"
|
|
|
|
|
|
|
|
p.evaluate ->
|
2012-09-18 22:07:02 +04:00
|
|
|
callbackResponse = callPhantom("Hello, I'm coming to you from the 'page' context")
|
2012-05-12 04:32:16 +04:00
|
|
|
console.log "Received by the 'page' context: " + callbackResponse
|
|
|
|
|
|
|
|
phantom.exit()
|