frontflesh-service
v0.0.4
Published
Base class to create service
Downloads
4
Readme
frontflesh-service
Install
$ npm install frontflesh-service
Usage
import Service from 'frontflesh/service/Service';
class HttpService extends Service {
fetch(fetchOptions = {}) {
const promise = new Promise(() => {
// (...)
});
// (...)
return promise;
}
}
// use the singleton (inherited by the Service class)
HttpService.get().fetch({ url: 'http://www.google.fr', headers: { 'Content-Type': 'text/html; charset=utf-8' } })
.then(function () {
// (...)
});
// or if you need something more specific
let myService = new HttpService({ 'cache-capacity': 1200 });
myService.fetch({ url: 'http://www.google.fr', headers: { 'Content-Type': 'text/html; charset=utf-8' } })
.then(function () {
// (...)
});