index.js
function togglify(win, opts) {
	// extend options for toggle window
	opts = oassign({
		animation: 'hide'
	}, opts);

	win._toggleAction = new ToggleAnimation(win, opts.animation);

	// patch toggle function to window
	win.toggle = function () {
		if (this.isVisible() && this.isFocused()) {
			this._toggleAction.hide();
		} else if (this.isVisible() && !this.isFocused()) {
			this._toggleAction.focus();
		} else if (this.isMinimized() || !this.isVisible()) {
			this._toggleAction.restore();
		}
	};

	// bind event for default action
	win.on('blur', function () {
		if (win.isVisible()) {
			this._toggleAction.blur();
		}
	});

	return win;
}
function togglify(win, opts) {
	// extend options for toggle window
	opts = oassign({
		animation: 'hide'
	}, opts);

	win._toggleAction = new ToggleAnimation(win, opts.animation);

	// patch toggle function to window
	win.toggle = function () {
		if (this.isVisible() && this.isFocused()) {
			this._toggleAction.hide();
		} else if (this.isVisible() && !this.isFocused()) {
			this._toggleAction.focus();
		} else if (this.isMinimized() || !this.isVisible()) {
			this._toggleAction.restore();
		}
	};

	// bind event for default action
	win.on('blur', function () {
		if (win.isVisible()) {
			this._toggleAction.blur();
		}
	});

	return win;
}
function togglify ( win , opts ) { // extend options for toggle window opts = oassign ( { animation : 'hide' } , opts ) ; win . _toggleAction = new ToggleAnimation ( win , opts . animation ) ; // patch toggle function to window win . toggle = function ( ) { if ( this . isVisible ( ) && this . isFocused ( ) ) { this . _toggleAction . hide ( ) ; } else if ( this . isVisible ( ) && ! this . isFocused ( ) ) { this . _toggleAction . focus ( ) ; } else if ( this . isMinimized ( ) || ! this . isVisible ( ) ) { this . _toggleAction . restore ( ) ; } } ; // bind event for default action win . on ( 'blur' , function ( ) { if ( win . isVisible ( ) ) { this . _toggleAction . blur ( ) ; } } ) ; return win ; }
Set window to be able to togggle
Set window to be able to togggle