function FlashEEPROM(addr, flash) {
  this.flash = flash ? flash : require("Flash");
  if (addr) {
    this.addr = addr;
  } else if (this.flash.getFree!==undefined) {
    var free = this.flash.getFree();
    if (free.length) this.addr = free[0].addr;
    else throw "No free flash memory found";
  } else { 
    // TODO: remove this after 1v86 is released
    var mem = process.memory();
    if (!mem.flash_start || !mem.flash_length)
      throw "process.memory() didn't contain information about flash memory";  
    this.addr = mem.flash_start + mem.flash_length;
  }
  var page = this.flash.getPage(this.addr);
  if (!page) throw "Couldn't find flash page";
  this.addr = page.addr;
  this.endAddr = page.addr+page.length;
}
/** Create a new Flash EEPROM.

 `addr` - addr to start at (if left off, this will be the address 
   after the last page of Flash. In the Original Espruino and 
   Espruino Pico, this is an flash page that isn't supposed to
   be in the chip - but which is on every one we have tested.
   
 `flash` - the flash object to use (it will use the internal 
   flash if this undefined). If an object implements read, write,
   erasePage and getPage then it can be used 
*/
Create a new Flash EEPROM.
`addr` - addr to start at (if left off, this will be the address
after the last page of Flash. In the Original Espruino and
Espruino Pico, this is an flash page that isn't supposed to
be in the chip - but which is on every one we have tested.

`flash` - the flash object to use (it will use the internal
flash if this undefined). If an object implements read, write,
erasePage and getPage then it can be used
Create a new Flash EEPROM . ` addr ` - addr to start at ( if left off this will be the address after the last page of Flash . In the Original Espruino and Espruino Pico this is an flash page that isn ' t supposed to be in the chip - but which is on every one we have tested . ` flash ` - the flash object to use ( it will use the internal flash if this undefined ) . If an object implements read write erasePage and getPage then it can be used
function FlashEEPROM(addr, flash) {
  this.flash = flash ? flash : require("Flash");
  if (addr) {
    this.addr = addr;
  } else if (this.flash.getFree!==undefined) {
    var free = this.flash.getFree();
    if (free.length) this.addr = free[0].addr;
    else throw "No free flash memory found";
  } else { 
    var mem = process.memory();
    if (!mem.flash_start || !mem.flash_length)
      throw "process.memory() didn't contain information about flash memory";  
    this.addr = mem.flash_start + mem.flash_length;
  }
  var page = this.flash.getPage(this.addr);
  if (!page) throw "Couldn't find flash page";
  this.addr = page.addr;
  this.endAddr = page.addr+page.length;
}
function FlashEEPROM ( addr , flash ) { this . flash = flash ? flash : require ( "Flash" ) ; if ( addr ) { this . addr = addr ; } else if ( this . flash . getFree !== undefined ) { var free = this . flash . getFree ( ) ; if ( free . length ) this . addr = free [ 0 ] . addr ; else throw "No free flash memory found" ; } else { var mem = process . memory ( ) ; if ( ! mem . flash_start || ! mem . flash_length ) throw "process.memory() didn't contain information about flash memory" ; this . addr = mem . flash_start + mem . flash_length ; } var page = this . flash . getPage ( this . addr ) ; if ( ! page ) throw "Couldn't find flash page" ; this . addr = page . addr ; this . endAddr = page . addr + page . length ; }
Create a new Flash EEPROM.
Create a new Flash EEPROM .
// TODO: remove this after 1v86 is released