From 82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Apr 2017 03:09:25 +0200 Subject: 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. --- src/cryptoApi.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/cryptoApi.ts') 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 { - return this.doRpc("createPreCoin", 1, denom, reserve); + return this.doRpc("createPreCoin", 1, denom, reserve); } hashString(str: string): Promise { - return this.doRpc("hashString", 1, str); + return this.doRpc("hashString", 1, str); } isValidDenom(denom: DenominationRecord, masterPub: string): Promise { - return this.doRpc("isValidDenom", 2, denom, masterPub); + return this.doRpc("isValidDenom", 2, denom, masterPub); } signDeposit(offer: OfferRecord, cds: CoinWithDenom[]): Promise { - return this.doRpc("signDeposit", 3, offer, cds); + return this.doRpc("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 { - return this.doRpc("rsaUnblind", 4, sig, bk, pk); + return this.doRpc("rsaUnblind", 4, sig, bk, pk); } createRefreshSession(exchangeBaseUrl: string, @@ -253,7 +253,7 @@ export class CryptoApi { meltCoin: CoinRecord, newCoinDenoms: DenominationRecord[], meltFee: AmountJson): Promise { - return this.doRpc("createRefreshSession", + return this.doRpc("createRefreshSession", 4, exchangeBaseUrl, kappa, -- cgit v1.2.3