get-web-manifest
v1.0.1
Published
Obtain the manifest for the current page
Downloads
2
Readme
get-web-manifest
Obtain the manifest for the current page
Why?
There are a number of reasons why you might want to access the manifest of the current page. I wrote this because I'm interested in using Web Share Target, and the spec explicitly permits customization of the registration mechanism. By connecting multiple applications to the same sharing system, users of any app will be able to share data with any other application, even on browsers that don't yet support Web Share.
Installation
npm install --save get-web-manifest
Usage
get-web-manifest
will use a custom fetch
function if given; for example, if you want to use a polyfill, pass it as an argument. If no polyfill is given then it will fall back to window.fetch
.
// Supplying your own polyfill
import fetch from 'isomorphic-fetch';
import getWebManifest from 'get-web-manifest';
export async function doSomething() {
await getWebManifest({
fetch: fetch,
});
}
// Relying on `window.fetch`
import getWebManifest from 'get-web-manifest';
export async function doSomething() {
await getWebManifest();
}