lib/public/build/editor.js
function(win) {
    win = win || window;
    
    this.lastFocus = new Date().getTime();
    this._isFocused = true;
    
    var _self = this;

    // IE < 9 supports focusin and focusout events
    if ("onfocusin" in win.document) {
        event.addListener(win.document, "focusin", function(e) {
            _self._setFocused(true);
        });

        event.addListener(win.document, "focusout", function(e) {
            _self._setFocused(!!e.toElement);
        });
    }
    else {
        event.addListener(win, "blur", function(e) {
            _self._setFocused(false);
        });

        event.addListener(win, "focus", function(e) {
            _self._setFocused(true);
        });
    }
}
function(win) {
    win = win || window;
    
    this.lastFocus = new Date().getTime();
    this._isFocused = true;
    
    var _self = this;

    // IE < 9 supports focusin and focusout events
    if ("onfocusin" in win.document) {
        event.addListener(win.document, "focusin", function(e) {
            _self._setFocused(true);
        });

        event.addListener(win.document, "focusout", function(e) {
            _self._setFocused(!!e.toElement);
        });
    }
    else {
        event.addListener(win, "blur", function(e) {
            _self._setFocused(false);
        });

        event.addListener(win, "focus", function(e) {
            _self._setFocused(true);
        });
    }
}
function ( win ) { win = win || window ; this . lastFocus = new Date ( ) . getTime ( ) ; this . _isFocused = true ; var _self = this ; // IE < 9 supports focusin and focusout events if ( "onfocusin" in win . document ) { event . addListener ( win . document , "focusin" , function ( e ) { _self . _setFocused ( true ) ; } ) ; event . addListener ( win . document , "focusout" , function ( e ) { _self . _setFocused ( ! ! e . toElement ) ; } ) ; } else { event . addListener ( win , "blur" , function ( e ) { _self . _setFocused ( false ) ; } ) ; event . addListener ( win , "focus" , function ( e ) { _self . _setFocused ( true ) ; } ) ; } }
This class keeps track of the focus state of the given window.
Focus changes for example when the user switches a browser tab,
goes to the location bar or switches to another application.
This class keeps track of the focus state of the given window . Focus changes for example when the user switches a browser tab goes to the location bar or switches to another application .