hasOnBeforeUnload.js 429 B

123456789101112131415161718
  1. /**
  2. * Simple example of custom command. This command will
  3. * check if there's a onbeforeunload handler in the target web page
  4. * and return the result
  5. */
  6. /* global window */
  7. module.exports.command = function(callback) {
  8. var self = this;
  9. this.execute(function() {
  10. return window && typeof window.onbeforeunload === 'function';
  11. }, [], function(result) {
  12. callback.call(self, result.value);
  13. });
  14. return this;
  15. };