Right now, we need to pollute the global scope with a fetch polyfill in order to use this module.
It'd be great if the library provided an explicit API to provide the required fetch polyfill, so that an application doesn't need to pollute the global scope in order to make a single library happy.
A possible interface would look like this:
// ES Modules syntax
import Unsplash from 'unsplash-js';
import fetchPolyfill from 'node-fetch';
const unsplash = new Unsplash({
fetch: fetchPolyfill,
accessKey: "{APP_ACCESS_KEY}"
});
Right now, we need to pollute the global scope with a
fetch
polyfill in order to use this module.It'd be great if the library provided an explicit API to provide the required
fetch
polyfill, so that an application doesn't need to pollute the global scope in order to make a single library happy.A possible interface would look like this: