1234567891011121314151617181920212223242526272829303132333435 |
- Command-line usage example:
- $ ZOMBIE_NAVIGATOR_SCRIPT_PATH=/tmp/script.js firefox
- /tmp/script.js:
- 'use strict';
- const {delay, run} = require('zombie/async');
- const {console} = require('zombie/zombie');
- run(function* () {
- const {openWindow, openPrivateWindow} = require('zombie/webbrowser');
- try {
- let window1 = yield openWindow('about:');
- console.log(window1.uri);
- yield delay(5); // sleep for 5 seconds
- let promise = window1.runScript(uri => {
- location.href = uri;
- return 42;
- }, 'about:buildconfig');
- yield window1.waitForReload();
- console.log((yield promise), window1.uri);
- yield delay(10.5); // sleep for 10.5 seconds
- yield window1.close();
- console.log('closed');
- } catch (e) {
- console.error('Error:', e);
- }
- })
- .catch(function (e) {
- // uncaught exceptions
- });
- # vim: ts=4 noet ai
|