update.js
function clientSave() {

    u.each(sources, function(source) {

      var dirtyFiles = u.filter(source.files, function(file) {
        if (file._dirty) {  // 1 means unsaved, 2 means saving
          file._dirty = 2;  // side effect of filter
          return true;
        }
        return false;
      });

      if (dirtyFiles.length) {

        var files = u.map(dirtyFiles, generator.serializeFile);

        debug('clientSave %s files, %s...', files.length, files[0].text.slice(0,200));

        // static save from browser directly to source
        if (opts.staticHost && source.staticSrc && source.src) {

          // NOTE: subtle difference in data compared to httpClient.put()
          source.src.put(files, function(err, savedFiles) {

            if (err || (u.size(savedFiles) !== u.size(dirtyFiles))) {
              // notify user on save errors
              return notify('error saving files, please check your internet connection');
            }

            u.each(dirtyFiles, function(file) {

              // no collision detection support with static saves (for now)
              file._oldtext = file.text;

              // only mark as clean if unchanged while waiting for save
              if (file._dirty === 2) { delete file._dirty; }
            });

            return source.verbose && notify(u.size(savedFiles) + ' file(s) saved');
          });
        }

        // normal (non-static) save from browser to pub-server
        else {
          httpClient.put({ source:source.name, files:files }, function(err, savedFiles) {

            if (err || (u.size(savedFiles) !== u.size(dirtyFiles))) {
              if (err) { log(err); }
              // notify user on save errors
              return notify('error saving files, please check your internet connection');
            }

            u.each(dirtyFiles, function(file, idx) {

              var savedFile = savedFiles[idx];

              if (typeof savedFile !== 'object') {
                // most likely a collision - must notify user
                return notify('error saving file: ' + savedFile);
              }

              // preserve for next update
              file._oldtext = savedFile.text;

              // only mark as clean if unchanged while waiting for save
              if (file._dirty === 2) { delete file._dirty; }

            });

            return source.verbose && notify(u.size(savedFiles) + ' file(s) saved');
          });
        }
      }
    });
  }
function clientSave() {

    u.each(sources, function(source) {

      var dirtyFiles = u.filter(source.files, function(file) {
        if (file._dirty) {  // 1 means unsaved, 2 means saving
          file._dirty = 2;  // side effect of filter
          return true;
        }
        return false;
      });

      if (dirtyFiles.length) {

        var files = u.map(dirtyFiles, generator.serializeFile);

        debug('clientSave %s files, %s...', files.length, files[0].text.slice(0,200));

        // static save from browser directly to source
        if (opts.staticHost && source.staticSrc && source.src) {

          // NOTE: subtle difference in data compared to httpClient.put()
          source.src.put(files, function(err, savedFiles) {

            if (err || (u.size(savedFiles) !== u.size(dirtyFiles))) {
              // notify user on save errors
              return notify('error saving files, please check your internet connection');
            }

            u.each(dirtyFiles, function(file) {

              // no collision detection support with static saves (for now)
              file._oldtext = file.text;

              // only mark as clean if unchanged while waiting for save
              if (file._dirty === 2) { delete file._dirty; }
            });

            return source.verbose && notify(u.size(savedFiles) + ' file(s) saved');
          });
        }

        // normal (non-static) save from browser to pub-server
        else {
          httpClient.put({ source:source.name, files:files }, function(err, savedFiles) {

            if (err || (u.size(savedFiles) !== u.size(dirtyFiles))) {
              if (err) { log(err); }
              // notify user on save errors
              return notify('error saving files, please check your internet connection');
            }

            u.each(dirtyFiles, function(file, idx) {

              var savedFile = savedFiles[idx];

              if (typeof savedFile !== 'object') {
                // most likely a collision - must notify user
                return notify('error saving file: ' + savedFile);
              }

              // preserve for next update
              file._oldtext = savedFile.text;

              // only mark as clean if unchanged while waiting for save
              if (file._dirty === 2) { delete file._dirty; }

            });

            return source.verbose && notify(u.size(savedFiles) + ' file(s) saved');
          });
        }
      }
    });
  }
function clientSave ( ) { u . each ( sources , function ( source ) { var dirtyFiles = u . filter ( source . files , function ( file ) { if ( file . _dirty ) { // 1 means unsaved, 2 means saving file . _dirty = 2 ; // side effect of filter return true ; } return false ; } ) ; if ( dirtyFiles . length ) { var files = u . map ( dirtyFiles , generator . serializeFile ) ; debug ( 'clientSave %s files, %s...' , files . length , files [ 0 ] . text . slice ( 0 , 200 ) ) ; // static save from browser directly to source if ( opts . staticHost && source . staticSrc && source . src ) { // NOTE: subtle difference in data compared to httpClient.put() source . src . put ( files , function ( err , savedFiles ) { if ( err || ( u . size ( savedFiles ) !== u . size ( dirtyFiles ) ) ) { // notify user on save errors return notify ( 'error saving files, please check your internet connection' ) ; } u . each ( dirtyFiles , function ( file ) { // no collision detection support with static saves (for now) file . _oldtext = file . text ; // only mark as clean if unchanged while waiting for save if ( file . _dirty === 2 ) { delete file . _dirty ; } } ) ; return source . verbose && notify ( u . size ( savedFiles ) + ' file(s) saved' ) ; } ) ; } // normal (non-static) save from browser to pub-server else { httpClient . put ( { source : source . name , files : files } , function ( err , savedFiles ) { if ( err || ( u . size ( savedFiles ) !== u . size ( dirtyFiles ) ) ) { if ( err ) { log ( err ) ; } // notify user on save errors return notify ( 'error saving files, please check your internet connection' ) ; } u . each ( dirtyFiles , function ( file , idx ) { var savedFile = savedFiles [ idx ] ; if ( typeof savedFile !== 'object' ) { // most likely a collision - must notify user return notify ( 'error saving file: ' + savedFile ) ; } // preserve for next update file . _oldtext = savedFile . text ; // only mark as clean if unchanged while waiting for save if ( file . _dirty === 2 ) { delete file . _dirty ; } } ) ; return source . verbose && notify ( u . size ( savedFiles ) + ' file(s) saved' ) ; } ) ; } } } ) ; }
clientSave currently used only in browser
clientSave currently used only in browser