usage 841 B

1234567891011121314151617181920212223242526272829303132333435
  1. Command-line usage example:
  2. $ ZOMBIE_NAVIGATOR_SCRIPT_PATH=/tmp/script.js firefox
  3. /tmp/script.js:
  4. 'use strict';
  5. const {delay, run} = require('zombie/async');
  6. const {console} = require('zombie/zombie');
  7. run(function* () {
  8. const {openWindow, openPrivateWindow} = require('zombie/webbrowser');
  9. try {
  10. let window1 = yield openWindow('about:');
  11. console.log(window1.uri);
  12. yield delay(5); // sleep for 5 seconds
  13. let promise = window1.runScript(uri => {
  14. location.href = uri;
  15. return 42;
  16. }, 'about:buildconfig');
  17. yield window1.waitForReload();
  18. console.log((yield promise), window1.uri);
  19. yield delay(10.5); // sleep for 10.5 seconds
  20. yield window1.close();
  21. console.log('closed');
  22. } catch (e) {
  23. console.error('Error:', e);
  24. }
  25. })
  26. .catch(function (e) {
  27. // uncaught exceptions
  28. });
  29. # vim: ts=4 noet ai