File incremental update for new version

This commit is contained in:
brunosimon
2016-08-11 21:57:07 +02:00
parent bdda23cc43
commit a73a484d2a
4 changed files with 37 additions and 21 deletions
+4
View File
@@ -17,6 +17,7 @@ class File
this.path.full = this.path.directory + '/' + this.name
this.path.parts = this.path.full.split( paths.separator )
this.versions = []
this.socket = _options.socket
// Create first version
if( typeof _options.content !== 'undefined' )
@@ -33,6 +34,9 @@ class File
version.content = content
version.diff = last_version ? diff.diffChars( last_version.content, version.content ) : false
// Emit
this.socket.emit( 'create_version', { file: this.path.full, version: version } )
// Save
this.versions.push( version )
}