Phantomjs-onclosing
提供:Dev Guides
PhantomJS-onClosing()
このメソッドは、* page.close()関数または window.close()*関数を使用してウィンドウが閉じられたときに呼び出されます。
構文
その構文は次のとおりです-
var wpage = require('webpage').create();
wpage.onClosing = function(str) {}
例
var wpage = require('webpage').create();
wpage.onClosing = function(str) {
console.log("page is closed");
}
wpage.open('http://localhost/tasks/closingl', function(status) {
console.log(status);
wpage.close();
});
上記のプログラムは、次の output を生成します。
success
page is closed