Skip to content

Commit 1ad3998

Browse files
committed
methods for the policy object in 'new-win-policy'
1 parent cdba41f commit 1ad3998

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/api/window_bindings.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ Window.prototype.handleEvent = function(ev) {
136136
this.removeListener(ev, listeners_copy[i]);
137137
}
138138

139+
if (ev == 'new-win-policy' && arguments.length > 3) {
140+
var policy = arguments[3];
141+
policy.ignore = function () { this.val = 'ignore'; };
142+
policy.forceCurrent = function () { this.val = 'current'; };
143+
policy.forceDownload = function () { this.val = 'download'; };
144+
policy.forceNewWindow = function () { this.val = 'new-window'; };
145+
policy.forceNewPopup = function () { this.val = 'new-popup'; };
146+
}
139147
// Route events to EventEmitter.
140148
this.emit.apply(this, arguments);
141149

0 commit comments

Comments
 (0)