Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

comlink-fetch

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

comlink-fetch - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

22

examples/app.js
import { Comlink } from 'https://cdn.jsdelivr.net/npm/comlinkjs@2.3/comlink.global.min.js';
const fetchWorker = new Worker('./../src/fetch.worker.js');
const worker = new Worker('./../src/fetch.worker.js');
const api = Comlink.proxy(fetchWorker);
const proxy = Comlink.proxy(worker);
async function init() {
const backend = await new api.Backend();
const Fetch = await new proxy.Fetch();
backend.setBaseUrl("https://jsonplaceholder.typicode.com/");
backend.setDefaultHeaders({'Content-Type': 'application/json'});
backend.setDefaultBody({lang: 'en'});
Fetch.setBaseUrl("https://jsonplaceholder.typicode.com/");
Fetch.setDefaultHeaders({'Content-Type': 'application/json'});
Fetch.setDefaultBody({lang: 'en'});
backend.get('users/1');
backend.get('users/2');
backend.post('posts/3');
backend.put('posts/4');
backend.delete('posts/5');
Fetch.get('users/1');
Fetch.get('users/2');
Fetch.post('posts/3');
Fetch.put('posts/4');
Fetch.delete('posts/5');
};

@@ -20,0 +20,0 @@

{
"name": "comlink-fetch",
"version": "0.0.1",
"version": "0.1.0",
"description": "A Web worker fetch wrapper using comlink ",

@@ -5,0 +5,0 @@ "main": "src/fetch.worker.js",

# Comlink Fetch
An ES6 wrapper around fetch for [GoogleChromeLabs/comlink](https://github.com/GoogleChromeLabs/comlink)
# Install
```
npm install comlink-fetch --save
```
importScripts('https://cdn.jsdelivr.net/npm/comlinkjs@2.3/comlink.global.min.js');
class Backend {
class Fetch {
constructor() {

@@ -5,0 +5,0 @@ this._baseUrl = "";

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc