trpc-browser
Advanced tools
Comparing version
{ | ||
"name": "trpc-browser", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "tRPC adapters and links for everywhere in the browser", | ||
@@ -5,0 +5,0 @@ "author": "Janek Rahrt <janek.rahrt@me.com>, James Berry <jb@jamesbe.com>", |
/// <reference types="chrome" /> | ||
/// <reference types="chrome" /> | ||
type AllowCleanUpFunction = void | (() => void); | ||
@@ -10,4 +9,4 @@ /** | ||
*/ | ||
export declare function autoConnect(browser: typeof chrome, onConnect: (port: chrome.runtime.Port) => AllowCleanUpFunction): Promise<void>; | ||
export declare function autoConnect(createPort: () => chrome.runtime.Port, onConnect: (port: chrome.runtime.Port) => AllowCleanUpFunction): Promise<void>; | ||
export {}; | ||
//# sourceMappingURL=chrome.d.ts.map |
@@ -11,5 +11,5 @@ "use strict"; | ||
*/ | ||
async function autoConnect(browser, onConnect) { | ||
const port = await (0, retry_1.retry)(() => browser.runtime.connect(), 3, // 3 retries | ||
(retry) => (0, retry_1.wait)(retry * 150)); | ||
async function autoConnect(createPort, onConnect) { | ||
const port = await (0, retry_1.retry)(createPort, 3, // 3 retries plus the initial try, so 4 total tries | ||
(retry) => (0, retry_1.wait)(retry * 100)); | ||
console.log('Port connected'); | ||
@@ -20,3 +20,3 @@ const cleanUp = onConnect(port); | ||
console.log('Port disconnected, reconnecting...'); | ||
void autoConnect(browser, onConnect); | ||
void autoConnect(createPort, onConnect); | ||
}); | ||
@@ -23,0 +23,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
72452
-0.02%751
-0.13%