Skip to content
Yanis Wang edited this page Jul 10, 2014 · 4 revisions

About

Set pagerun object to browser.

So you can use some api in browser, like: pagerun.info('test' , 'message').

And all debug info will been catched, such as: console.log, alert, confirm, prompt

Config

pagerun.setConfig({
	'bridge': {
		'delayDefaultEnd': 2000
	}
});
  1. delayDefaultEnd

    Bridge will end after onload, this option will delay the end time.

    Unit: microsecond.

Api in browser

pagerun.newTask(name, taskFunc)

This api will create a async task, pagerun will wait task until the task call this.end();

pagerun.newTask('taskname', function(){
	var task = this;
	task.info('start');
	setTimeout(function(){
		task.info('end');
		task.end();
	}, 2000);
});

The context support 4 apis:

  1. task.error : report error message
  2. task.warn : report warning message
  3. task.info : report info message
  4. task.end : end this task

pagerun.error(module, message)

Report error message directly.

pagerun.warn(module, message)

Report warn message directly.

pagerun.info(module, message)

Report info message directly.

pagerun.getResult(isToString)

Get all message result.

pagerun.on(eventName, callback)

Bind pagerun event.

pagerun.emit(eventName)

Emit pagerun event.