diff options
Diffstat (limited to 'vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/pagecallback.coffee')
-rw-r--r-- | vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/pagecallback.coffee | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/pagecallback.coffee b/vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/pagecallback.coffee new file mode 100644 index 00000000..1af7a792 --- /dev/null +++ b/vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/pagecallback.coffee @@ -0,0 +1,16 @@ +p = require("webpage").create() + +p.onConsoleMessage = (msg) -> + console.log msg + +# Calls to "callPhantom" within the page 'p' arrive here +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 -> + # Return-value of the "onCallback" handler arrive here + callbackResponse = window.callPhantom "Hello, I'm coming to you from the 'page' context" + console.log "Received by the 'page' context: " + callbackResponse + +phantom.exit() |