Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bed578e80d |
@@ -20,12 +20,13 @@ export default class WebStorage {
|
|||||||
* @param {import('@twurple/auth').AuthProvider} auth_provider used to add the authentication header to requests for web storage
|
* @param {import('@twurple/auth').AuthProvider} auth_provider used to add the authentication header to requests for web storage
|
||||||
* @param {fetch} fetch defaults to `globalThis.fetch`, allows you to further customize fetch behavior via chaining, for example with `fetch-retry`
|
* @param {fetch} fetch defaults to `globalThis.fetch`, allows you to further customize fetch behavior via chaining, for example with `fetch-retry`
|
||||||
*/
|
*/
|
||||||
constructor(auth_provider: import('@twurple/auth').AuthProvider, fetch: typeof globalThis.fetch = (resource,options)=>{return globalThis.fetch(resource,options)}) {
|
constructor(auth_provider: import('@twurple/auth').AuthProvider, fetch: typeof globalThis.fetch = globalThis.fetch, origin?: string) {
|
||||||
this.#fetch = fetch
|
this.#fetch = fetch
|
||||||
this.#auth_provider = auth_provider
|
this.#auth_provider = auth_provider
|
||||||
auth_provider.getAccessTokenForUser(undefined)
|
auth_provider.getAccessTokenForUser(undefined)
|
||||||
.then(token => caches.open(token.userId + '/' + auth_provider.clientId))
|
.then(token => caches.open(token.userId + '/' + auth_provider.clientId))
|
||||||
.then(cache => this.#cache = cache)
|
.then(cache => this.#cache = cache)
|
||||||
|
if (origin) this.#origin = origin
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user