archive/v1/client/emitUpdates.js
function getUpdates() {
		return _client.method('WaitForUpdatesEx', {
			_this: _client._updatesCollector,
			version: _client._updatesVersion,
			options: {
				maxWaitSeconds: 0
			}
		})
		.then(function(set) {
			if (set) {

				// update the version
				_client._updatesVersion = set.version;
				
				// get only the updates
				var updates   = [];
				var filterSet = _.get(set, 'filterSet');
				filterSet     = Array.isArray(filterSet) ? filterSet : [filterSet];
				
				// loop through the filter sets
				_.forEach(filterSet, function(f) {
					
					var objectSet = _.get(f, 'objectSet');
					objectSet     = Array.isArray(objectSet) ? objectSet : [objectSet];
					
					// format the objects
					_.forEach(objectSet, function(u) {
						u.obj = {
							type: _.get(u, 'obj.attributes.type'),
							id: _.get(u, 'obj.$value')
						};
						
						// make the change set an array
						u.changeSet = Array.isArray(u.changeSet) ? u.changeSet : [u.changeSet];
						
						// update change set
						_.forEach(u.changeSet, function(c) {
							c.val = _.get(c, 'val.$value');
						});
						
						// push the update
						updates.push(u);
					});
				});

				// emit the results
				_client.emit('updates', updates);
			}
		});
	}
function getUpdates() {
		return _client.method('WaitForUpdatesEx', {
			_this: _client._updatesCollector,
			version: _client._updatesVersion,
			options: {
				maxWaitSeconds: 0
			}
		})
		.then(function(set) {
			if (set) {

				// update the version
				_client._updatesVersion = set.version;
				
				// get only the updates
				var updates   = [];
				var filterSet = _.get(set, 'filterSet');
				filterSet     = Array.isArray(filterSet) ? filterSet : [filterSet];
				
				// loop through the filter sets
				_.forEach(filterSet, function(f) {
					
					var objectSet = _.get(f, 'objectSet');
					objectSet     = Array.isArray(objectSet) ? objectSet : [objectSet];
					
					// format the objects
					_.forEach(objectSet, function(u) {
						u.obj = {
							type: _.get(u, 'obj.attributes.type'),
							id: _.get(u, 'obj.$value')
						};
						
						// make the change set an array
						u.changeSet = Array.isArray(u.changeSet) ? u.changeSet : [u.changeSet];
						
						// update change set
						_.forEach(u.changeSet, function(c) {
							c.val = _.get(c, 'val.$value');
						});
						
						// push the update
						updates.push(u);
					});
				});

				// emit the results
				_client.emit('updates', updates);
			}
		});
	}
function getUpdates ( ) { return _client . method ( 'WaitForUpdatesEx' , { _this : _client . _updatesCollector , version : _client . _updatesVersion , options : { maxWaitSeconds : 0 } } ) . then ( function ( set ) { if ( set ) { // update the version _client . _updatesVersion = set . version ; // get only the updates var updates = [ ] ; var filterSet = _ . get ( set , 'filterSet' ) ; filterSet = Array . isArray ( filterSet ) ? filterSet : [ filterSet ] ; // loop through the filter sets _ . forEach ( filterSet , function ( f ) { var objectSet = _ . get ( f , 'objectSet' ) ; objectSet = Array . isArray ( objectSet ) ? objectSet : [ objectSet ] ; // format the objects _ . forEach ( objectSet , function ( u ) { u . obj = { type : _ . get ( u , 'obj.attributes.type' ) , id : _ . get ( u , 'obj.$value' ) } ; // make the change set an array u . changeSet = Array . isArray ( u . changeSet ) ? u . changeSet : [ u . changeSet ] ; // update change set _ . forEach ( u . changeSet , function ( c ) { c . val = _ . get ( c , 'val.$value' ) ; } ) ; // push the update updates . push ( u ) ; } ) ; } ) ; // emit the results _client . emit ( 'updates' , updates ) ; } } ) ; }
function to get updates
function to get updates