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/pages/confirm-create-reserve.tsx | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/pages/confirm-create-reserve.tsx') diff --git a/src/pages/confirm-create-reserve.tsx b/src/pages/confirm-create-reserve.tsx index 6617ed6c3..a7fd7b0fd 100644 --- a/src/pages/confirm-create-reserve.tsx +++ b/src/pages/confirm-create-reserve.tsx @@ -22,17 +22,18 @@ * @author Florian Dold */ -import {amountToPretty, canonicalizeBaseUrl} from "src/helpers"; +import {amountToPretty, canonicalizeBaseUrl} from "../helpers"; import { AmountJson, CreateReserveResponse, ReserveCreationInfo, Amounts, Denomination, DenominationRecord, -} from "src/types"; -import {getReserveCreationInfo} from "src/wxApi"; -import {ImplicitStateComponent, StateHolder} from "src/components"; -import * as i18n from "src/i18n"; - -"use strict"; +} from "../types"; +import {getReserveCreationInfo} from "../wxApi"; +import {ImplicitStateComponent, StateHolder} from "../components"; +import * as i18n from "../i18n"; +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import URI = require("urijs"); function delay(delayMs: number, value: T): Promise { @@ -220,7 +221,7 @@ class ExchangeSelection extends ImplicitStateComponent { ); } if (this.url() && !this.statusString()) { - let shortName = URI(this.url()!).host(); + let shortName = new URI(this.url()!).host(); return ( Waiting for a response from @@ -283,7 +284,7 @@ class ExchangeSelection extends ImplicitStateComponent { } this.statusString(null); - let parsedUrl = URI(this.url()!); + let parsedUrl = new URI(this.url()!); if (parsedUrl.is("relative")) { this.statusString(i18n.str`Error: URL may not be relative`); this.detailCollapsed(false); @@ -350,7 +351,7 @@ class ExchangeSelection extends ImplicitStateComponent { amount_fraction: amount.fraction, amount_currency: amount.currency, }; - let url = URI(callback_url).addQuery(q); + let url = new URI(callback_url).addQuery(q); if (!url.is("absolute")) { throw Error("callback url is not absolute"); } @@ -393,7 +394,7 @@ class ExchangeSelection extends ImplicitStateComponent { export async function main() { try { - const url = URI(document.location.href); + const url = new URI(document.location.href); const query: any = URI.parseQuery(url.query()); let amount; try { @@ -432,3 +433,7 @@ export async function main() { console.error(`got error "${e.message}"`, e); } } + +document.addEventListener("DOMContentLoaded", () => { + main(); +}); -- cgit v1.2.3