Skip to content

Commit

Permalink
Improve Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
clarissedmn committed Feb 20, 2024
1 parent e769908 commit e8d02b5
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# VMAP Javascript Library

[![Build Status](https://travis-ci.org/dailymotion/vmap-js.png)](https://travis-ci.org/dailymotion/vmap-js)
[![Build Status](https://img.shields.io/badge/build-passing-brightgreen)](https://travis-ci.org/dailymotion/vmap-js)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![npm version](https://badge.fury.io/js/vmap.svg)](https://badge.fury.io/js/vmap)
Expand All @@ -11,7 +11,7 @@ Parse a VMAP XML document to Javascript object. Complies with [VMAP 1.0.1 spec](

Install with npm
```
npm install vmap
npm install @dailymotion/vmap
```

## Usage
Expand All @@ -24,17 +24,17 @@ Access `VMAP` properties using the APIs documented below.
import VMAP from '@dailymotion/vmap';

// Fetch VMAP as XML
const xhr = new XMLHttpRequest();
xhr.open('GET', vmapURL);
xhr.send();
xhr.onreadystatechange = function() {
if (xhr.readyState === xhr.DONE) {
if (xhr.status === 200) {
// Get a parsed VMAP object
const vmap = new VMAP(xhr.responseXML);
}
}
};
fetch(vmapURL)
.then(response => response.text())
.then(xmlText => {
// Get a parsed VMAP object
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlText, 'text/xml');
const vmap = new VMAP(xmlDoc);
})
.catch(error => {
console.error('Error fetching VMAP:', error);
});
```

## API
Expand Down

0 comments on commit e8d02b5

Please sign in to comment.