lib/sampler/sampler.js
function delivery(data) {
	var name = data.name;

	// Update the gatheredData object with the new data for this panopticon and emit its update.
	// This emission fires for every delivery, and contains the complete data across all panoptica.
	// This means that data may appear to be repeated (unless you check time stamps of course).

	gatheredData[name] = data;

	exports.emit('updatedData', gatheredData);

	// The delivery is data for this panopticon only, the others are not emitted here. That's also
	// how we keep the data in our buffer.

	var obj = {};
	obj[name] = data;

	if (bufferLength > 0) {
		bufferedData.push(obj);
	}

	exports.emit('panopticonDelivery', obj);

	// Maintain a maximum buffer length for each panopticon (remove the oldest samples).

	if (bufferedData.length > bufferLength) {
		bufferedData.splice(0, bufferedData.length - bufferLength);
	}
}
function delivery(data) {
	var name = data.name;

	// Update the gatheredData object with the new data for this panopticon and emit its update.
	// This emission fires for every delivery, and contains the complete data across all panoptica.
	// This means that data may appear to be repeated (unless you check time stamps of course).

	gatheredData[name] = data;

	exports.emit('updatedData', gatheredData);

	// The delivery is data for this panopticon only, the others are not emitted here. That's also
	// how we keep the data in our buffer.

	var obj = {};
	obj[name] = data;

	if (bufferLength > 0) {
		bufferedData.push(obj);
	}

	exports.emit('panopticonDelivery', obj);

	// Maintain a maximum buffer length for each panopticon (remove the oldest samples).

	if (bufferedData.length > bufferLength) {
		bufferedData.splice(0, bufferedData.length - bufferLength);
	}
}
function delivery ( data ) { var name = data . name ; // Update the gatheredData object with the new data for this panopticon and emit its update. // This emission fires for every delivery, and contains the complete data across all panoptica. // This means that data may appear to be repeated (unless you check time stamps of course). gatheredData [ name ] = data ; exports . emit ( 'updatedData' , gatheredData ) ; // The delivery is data for this panopticon only, the others are not emitted here. That's also // how we keep the data in our buffer. var obj = { } ; obj [ name ] = data ; if ( bufferLength > 0 ) { bufferedData . push ( obj ) ; } exports . emit ( 'panopticonDelivery' , obj ) ; // Maintain a maximum buffer length for each panopticon (remove the oldest samples). if ( bufferedData . length > bufferLength ) { bufferedData . splice ( 0 , bufferedData . length - bufferLength ) ; } }
This function is called when a panopticon emits a data set. It updates the buffer, and emits
the events `'panopticonDelivery'`, which forwards the panopticon data set, and `'updatedData'`,
which emits all data together.

@param {Object} data A panopticon data set.
This function is called when a panopticon emits a data set . It updates the buffer and emits the events panopticonDelivery which forwards the panopticon data set and updatedData which emits all data together .