Home Reference Source Repository

covjson-reader Build Status

A library that reads CoverageJSON documents and exposes them as Coverage objects.

API docs

Usage

A minified version of this library is hosted on the jsDelivr CDN.

Usage is simple:

<script src="https://cdn.jsdelivr.net/covjson-reader/0.1/covjson-reader.min.js"></script>
<script>
CovJSON.read('http://example.com/coverage.covjson').then(function (cov) {
  // work with Coverage object
}).catch(function (e) {
  // there was an error when loading the coverage
  console.log(e)
})
</script>

ECMAScript module

This library is written as an ECMAScript module and uses the JSPM loader SystemJS.

Here is how to import the module with SystemJS:

<script src="https://jspm.io/system.js"></script>
<script>
System.import('github:reading-escience-centre/[email protected]', function (CovJSON) {

  CovJSON.read('http://example.com/coverage.covjson').then(function (cov) {
    // work with Coverage object
  }).catch(function (e) {
    // there was an error when loading the coverage
    console.log(e)
  })

})
</script>

Note that the version hosted on jsDelivr was transpiled from ES6 to ES5 and exposes the module as a global object. This is for supporting classic usage and is different from directly using the ECMAScript module like above.

Acknowledgments

This library is developed within the MELODIES project.