B2G/gecko/browser/devtools/scratchpad/scratchpad.js
/**
   * Prompt to revert scratchpad if it has unsaved changes.
   *
   * @param function aCallback
   *        Optional function you want to call when file is saved. The callback
   *        receives three arguments:
   *          - aRevert (boolean) - tells if the file has been reverted.
   *          - status (number) - the file revert status result (if the file was
   *          saved).
   */
Prompt to revert scratchpad if it has unsaved changes.
@param function aCallback
Optional function you want to call when file is saved. The callback
receives three arguments:
- aRevert (boolean) - tells if the file has been reverted.
- status (number) - the file revert status result (if the file was
saved).
Prompt to revert scratchpad if it has unsaved changes . @param function aCallback Optional function you want to call when file is saved . The callback receives three arguments : - aRevert ( boolean ) - tells if the file has been reverted . - status ( number ) - the file revert status result ( if the file was saved ) .
function SP_promptRervert(aCallback)
  {
    if (this.filename) {
      let ps = Services.prompt;
      let flags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_REVERT +
                  ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL;
      let button = ps.confirmEx(window,
                          this.strings.GetStringFromName("confirmRevert.title"),
                          this.strings.GetStringFromName("confirmRevert"),
                          flags, null, null, null, null, {});
      if (button == BUTTON_POSITION_CANCEL) {
        if (aCallback) {
          aCallback(false);
        }
        return;
      }
      if (button == BUTTON_POSITION_REVERT) {
        this.revertFile(function(aStatus) {
          if(aCallback){
            aCallback(true, aStatus);
          }
        });
        return;
      }
    }
    if (aCallback) {
      aCallback(false);
    }
  }
function SP_promptRervert ( aCallback ) { if ( this . filename ) { let ps = Services . prompt ; let flags = ps . BUTTON_POS_0 * ps . BUTTON_TITLE_REVERT + ps . BUTTON_POS_1 * ps . BUTTON_TITLE_CANCEL ; let button = ps . confirmEx ( window , this . strings . GetStringFromName ( "confirmRevert.title" ) , this . strings . GetStringFromName ( "confirmRevert" ) , flags , null , null , null , null , { } ) ; if ( button == BUTTON_POSITION_CANCEL ) { if ( aCallback ) { aCallback ( false ) ; } return ; } if ( button == BUTTON_POSITION_REVERT ) { this . revertFile ( function ( aStatus ) { if ( aCallback ) { aCallback ( true , aStatus ) ; } } ) ; return ; } } if ( aCallback ) { aCallback ( false ) ; } }
Prompt to revert scratchpad if it has unsaved changes.
Prompt to revert scratchpad if it has unsaved changes .