Skip to content

Commit 925f0ea

Browse files
committed
[UPD] use open(url, callback) instead of onLoadFinished
1 parent 6812656 commit 925f0ea

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "page-monitor",
3-
"version": "0.4.5-1",
3+
"version": "0.4.6",
44
"description": "monitor pages and diff the dom change with phantomjs",
55
"main": "index.js",
66
"scripts": {

phantomjs/index.js

+16-9
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,14 @@ function createPage(url, options, onload){
133133
callback();
134134
}
135135
};
136-
page.onloadFinished = function(status){
137-
if(status === 'success'){
138-
callback();
139-
} else {
140-
log('load page error [' + status + ']', _.log.ERROR);
141-
phantom.exit(1);
142-
}
143-
};
136+
//page.onloadFinished = function(status){
137+
// if(status === 'success'){
138+
// callback();
139+
// } else {
140+
// log('load page error [' + status + ']', _.log.ERROR);
141+
// phantom.exit(1);
142+
// }
143+
//};
144144
page.onResourceRequested = function(req){
145145
count++;
146146
// console.log('+ [' + count + ']' + req.url);
@@ -185,7 +185,14 @@ function createPage(url, options, onload){
185185
log(msg, _.log.NOTICE);
186186
}
187187
};
188-
page.open(url);
188+
page.open(url, function(status){
189+
if(status === 'success'){
190+
callback();
191+
} else {
192+
log('load page error [' + status + ']', _.log.ERROR);
193+
phantom.exit(1);
194+
}
195+
});
189196
var timeout = options.render.timeout;
190197
if(timeout){
191198
outTimer = setTimeout(function(){

0 commit comments

Comments
 (0)