nl_tokens: comparing old dir children and new dir children - executed on change event
pl_tokens: function compareDirFiles ( parentId , old_children , descendants ) { var changes = [ ] , not_found = object . extend ( { } , old_children ) ; for ( var id in descendants ) { if ( descendants [ id ] . ancestors [ descendants [ id ] . ancestors . length - 1 ] === parentId ) { // compare only direct children if ( ! old_children [ id ] ) { // not found in current children - created changes . push ( { event : 'created' , file : descendants [ id ] } ) ; old_children [ id ] = descendants [ id ] ; } else if ( old_children [ id ] . modifiedDT < descendants [ id ] . modifiedDT ) { // found and updated changes . push ( { event : 'updated' , <mask> : descendants [ id ] } ) ; old_children [ id ] = descendants [ id ] ; delete not_found [ id ] ; } else { // file found, not not updated delete not_found [ id ] ; } } } // removed files for ( var id in not_found ) { changes . push ( { event : 'removed' , file : not_found [ id ] } ) ; delete old_children [ id ] ; } return changes ; }