fp-reporter
v1.0.1
Published
A simple class data-reporter for npm package
Downloads
27
Maintainers
Readme
Simple Data Reporting (DataReporter)
Installation
npm install fp-reporter
Demo
Create a DataReporter instance
import DataReporter from 'fp-reporter'
// Direct single case model
let reporter = DataReporter.getInstance({
reportFn: () => {} //Specific reporting method
delay: 300 //Reporting interval
});
// or create a new instance manually
let reporter = DataReporter.createInstance({
id: 'reporterDemo',
delay: 300, //Reporting interval
reportFn: () => {} //Specific reporting method
});
Collect reported data
/**
* collectData collects and reports data, and reports at delay intervals will be enabled after collection
*/
let reporter = collectData({
type: "click",
data: {},
});
Reporting data
//Batch report
let reporter = reportData([
{
type: "click",
data: {},
},
...
]);
//Single data reporting
let reporter = reportData({
type: "click",
data: {},
});