1.0.1 • Published 10 months ago

fp-reporter v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

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: {},
});
1.0.1

10 months ago

1.0.0

10 months ago