src/lib/page-lifecycle.js
/**
   * @param {Symbol|Object} id A unique symbol or object identifying the
   *.    pending state. This ID is required when removing the state later.
   */
@param {Symbol|Object} id A unique symbol or object identifying the
.    pending state. This ID is required when removing the state later.
@param { Symbol|Object } id A unique symbol or object identifying the . pending state . This ID is required when removing the state later .
addUnsavedChanges(id) {
    if (!this._unsavedChanges.indexOf(id) > -1) {
      if (this._unsavedChanges.length === 0) {
        addEventListener(EVENT_BEFOREUNLOAD, onbeforeunload);
      }
      this._unsavedChanges.push(id);
    }
  }
addUnsavedChanges ( id ) { if ( ! this . _unsavedChanges . indexOf ( id ) > - 1 ) { if ( this . _unsavedChanges . length === 0 ) { addEventListener ( EVENT_BEFOREUNLOAD , onbeforeunload ) ; } this . _unsavedChanges . push ( id ) ; } }
@param {Symbol|Object} id A unique symbol or object identifying the
.
@param { Symbol|Object } id A unique symbol or object identifying the .
// Don't add duplicate state. Note: ideally this would be a set, but for // better browser compatibility we're using an array. // If this is the first state being added, // also add a beforeunload listener.