Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(client): inject transport #700

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
wip: destructure injected prop
maurerbot committed Dec 17, 2022
commit bcc11cab22d2358cb7b896183ea67d4b8f26ece6
6 changes: 3 additions & 3 deletions src/components/client.ts
Original file line number Diff line number Diff line change
@@ -41,9 +41,9 @@ export class <%= className %> {
throw new Error("Invalid constructor params");
}

const {type, host, port, protocol} = options.transport;
const {type, host, port, protocol, injected} = options.transport;

if (type === "injected" && options.transport.injected === undefined) {
if (type === "injected" && injected === undefined) {
throw new Error("Missing injected transport");
}

@@ -53,7 +53,7 @@ export class <%= className %> {
}
switch (type) {
case 'injected':
this.transport = options.transport.injected;
this.transport = injected;
break;
case 'http':
case 'https':
6 changes: 3 additions & 3 deletions src/custom-test-component.js
Original file line number Diff line number Diff line change
@@ -38,9 +38,9 @@ export class <%= className %> {
throw new Error("Invalid constructor params");
}

const {type, host, port, protocol} = options.transport;
const {type, host, port, protocol, injected} = options.transport;

if (type === "injected" && options.transport.injected === undefined) {
if (type === "injected" && injected === undefined) {
throw new Error("Missing injected transport");
}

@@ -51,7 +51,7 @@ export class <%= className %> {

switch (type) {
case 'injected':
this.transport = options.transport.injected
this.transport = injected
break;
case 'http':
case 'https':