Add version diff to file
This commit is contained in:
@@ -19,15 +19,25 @@ class File
|
||||
create_version( content )
|
||||
{
|
||||
// Create version
|
||||
let version = {}
|
||||
let version = {},
|
||||
last_version = this.get_last_version()
|
||||
|
||||
// Set up
|
||||
version.date = new Date()
|
||||
version.content = content
|
||||
version.diff = last_version ? diff.diffChars( last_version.content, version.content ) : false
|
||||
|
||||
// Save
|
||||
this.versions.push( version )
|
||||
}
|
||||
|
||||
get_last_version()
|
||||
{
|
||||
if( this.versions.length === 0 )
|
||||
return false
|
||||
|
||||
return this.versions[ this.versions.length - 1 ]
|
||||
}
|
||||
|
||||
destructor()
|
||||
{
|
||||
console.log( 'destruct' )
|
||||
|
||||
Reference in New Issue
Block a user