Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ws.onmessage = ({ data }) => {
const meta = JSON.parse(data);
const getter = getDependencyResolver(globalDependencies, getDependencies);
const fetcher = (url: string) =>
fetch(url, {
method: 'GET',
cache: 'reload',
}).then(m => m.text());
loadPilet(meta, getter, fetcher).then(pilet => {
try {
const newApi = createApi(pilet);
context.injectPilet(pilet);
pilet.setup(newApi);
} catch (error) {
console.error(error);
}
});
};