Last active
January 23, 2018 17:42
-
-
Save jadjoubran/761fab3e464b9204d5bc881632a58372 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
importScripts('https://cdn.jsdelivr.net/npm/[email protected]/comlink.global.min.js'); | |
class Fetch { | |
constructor() | |
getBaseUrl() | |
getDefaultHeaders() | |
getDefaultBody() | |
setBaseUrl(baseUrl) | |
setDefaultHeaders(defaultHeaders) | |
setDefaultBody(defaultBody) | |
async get(endpoint = '') | |
async post(endpoint = '', body = undefined, headers = {}) | |
async put(endpoint = '', body = undefined, headers = {}) | |
async delete(endpoint = '', body = undefined, headers = {}) | |
async _send(method, endpoint = '', body = undefined, headers = {}) | |
} | |
Comlink.expose({ Fetch }, self); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment