diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-04-20 03:09:25 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-04-24 16:14:29 +0200 |
commit | 82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 (patch) | |
tree | 965f6eb89b84d65a62b49008fd972c004832ccd1 /src/cryptoApi.ts | |
parent | e6e0cbc387c2a77b48e4065c229daa65bf1aa0fa (diff) |
Reorganize module loading.
We now use webpack instead of SystemJS, effectively bundling modules
into one file (plus commons chunks) for every entry point. This results
in a much smaller extension size (almost half). Furthermore we use
yarn/npm even for extension run-time dependencies. This relieves us
from manually vendoring and building dependencies. It's also easier to
understand for new developers familiar with node.
Diffstat (limited to 'src/cryptoApi.ts')
-rw-r--r-- | src/cryptoApi.ts | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/cryptoApi.ts b/src/cryptoApi.ts index dbadb45e4..672b90d74 100644 --- a/src/cryptoApi.ts +++ b/src/cryptoApi.ts @@ -86,7 +86,7 @@ export class CryptoApi { ws.currentWorkItem = work; this.numBusy++; if (!ws.w) { - let w = new Worker("/src/cryptoWorker.js"); + let w = new Worker("/dist/cryptoWorker-bundle.js"); w.onmessage = (m: MessageEvent) => this.handleWorkerMessage(ws, m); w.onerror = (e: ErrorEvent) => this.handleWorkerError(ws, e); ws.w = w; @@ -215,7 +215,7 @@ export class CryptoApi { throw Error("assertion failed"); }); - return p.then((r) => { + return p.then((r: T) => { console.log(`rpc ${operation} took ${performance.now() - start}ms`); return r; }); @@ -223,29 +223,29 @@ export class CryptoApi { createPreCoin(denom: DenominationRecord, reserve: ReserveRecord): Promise<PreCoinRecord> { - return this.doRpc("createPreCoin", 1, denom, reserve); + return this.doRpc<PreCoinRecord>("createPreCoin", 1, denom, reserve); } hashString(str: string): Promise<string> { - return this.doRpc("hashString", 1, str); + return this.doRpc<string>("hashString", 1, str); } isValidDenom(denom: DenominationRecord, masterPub: string): Promise<boolean> { - return this.doRpc("isValidDenom", 2, denom, masterPub); + return this.doRpc<boolean>("isValidDenom", 2, denom, masterPub); } signDeposit(offer: OfferRecord, cds: CoinWithDenom[]): Promise<PayCoinInfo> { - return this.doRpc("signDeposit", 3, offer, cds); + return this.doRpc<PayCoinInfo>("signDeposit", 3, offer, cds); } createEddsaKeypair(): Promise<{priv: string, pub: string}> { - return this.doRpc("createEddsaKeypair", 1); + return this.doRpc<{priv: string, pub: string}>("createEddsaKeypair", 1); } rsaUnblind(sig: string, bk: string, pk: string): Promise<string> { - return this.doRpc("rsaUnblind", 4, sig, bk, pk); + return this.doRpc<string>("rsaUnblind", 4, sig, bk, pk); } createRefreshSession(exchangeBaseUrl: string, @@ -253,7 +253,7 @@ export class CryptoApi { meltCoin: CoinRecord, newCoinDenoms: DenominationRecord[], meltFee: AmountJson): Promise<RefreshSessionRecord> { - return this.doRpc("createRefreshSession", + return this.doRpc<RefreshSessionRecord>("createRefreshSession", 4, exchangeBaseUrl, kappa, |