js/core/file.js
// Save current file in files array and in chrome storage
Save current file in files array and in chrome storage
Save current file in files array and in chrome storage
function saveCurrentFile(){
    if(currentFile && currentFile !== null){
      if(isItemInArray(files, currentFile)){
        var currentIndex = findItemInArray(files, currentFile);
        if (currentFile.extension === 'js') {
          code = Espruino.Core.EditorJavaScript.getCodeMirror().getValue();
        } else {
          code = Espruino.Core.EditorBlockly.getXML();
        }
        currentFile.content = code;
        files[currentIndex] = currentFile;
        setFileStorage();
      }else{
        currentFile = null;
      }
    }
  }
function saveCurrentFile ( ) { if ( currentFile && currentFile !== null ) { if ( isItemInArray ( files , currentFile ) ) { var currentIndex = findItemInArray ( files , currentFile ) ; if ( currentFile . extension === 'js' ) { code = Espruino . Core . EditorJavaScript . getCodeMirror ( ) . getValue ( ) ; } else { code = Espruino . Core . EditorBlockly . getXML ( ) ; } currentFile . content = code ; files [ currentIndex ] = currentFile ; setFileStorage ( ) ; } else { currentFile = null ; } } }
Save current file in files array and in chrome storage
Save current file in files array and in chrome storage
// Check if the file exist inthe files array // Check if the current file was js or xml file and return code