Sha256: 7c3a9da2545a39640e6402a2779a60f051e779d225479e7031d8d1f1f877c3f6

Contents?: true

Size: 609 Bytes

Versions: 17

Compression:

Stored size: 609 Bytes

Contents

var p = require("webpage").create();

p.onConsoleMessage = function(msg) { console.log(msg); };

// Calls to "callPhantom" within the page 'p' arrive here
p.onCallback = function(msg) {
    console.log("Received by the 'phantom' main context: "+msg);
    return "Hello there, I'm coming to you from the 'phantom' context instead";
};

p.evaluate(function() {
    // Return-value of the "onCallback" handler arrive here
    var callbackResponse = window.callPhantom("Hello, I'm coming to you from the 'page' context");
    console.log("Received by the 'page' context: "+callbackResponse);
});

phantom.exit();

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
hooch-0.4.1 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
hooch-0.4.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
hooch-0.3.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
hooch-0.2.1 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
hooch-0.2.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
hooch-0.1.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
hooch-0.0.8 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
hooch-0.0.7 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
hooch-0.0.6 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
entangled-0.0.16 spec/dummy/public/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
entangled-0.0.15 spec/dummy/public/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
entangled-0.0.14 spec/dummy/public/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
entangled-0.0.13 spec/dummy/public/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
entangled-0.0.12 spec/dummy/public/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
entangled-0.0.11 spec/dummy/public/node_modules/phantomjs/lib/phantom/examples/pagecallback.js
entangled-0.0.10 spec/dummy/public/node_modules/phantomjs/lib/phantom/examples/pagecallback.js