aboutsummaryrefslogtreecommitdiff
path: root/src/pages/confirm-create-reserve.tsx
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-04-20 03:09:25 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-04-24 16:14:29 +0200
commit82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 (patch)
tree965f6eb89b84d65a62b49008fd972c004832ccd1 /src/pages/confirm-create-reserve.tsx
parente6e0cbc387c2a77b48e4065c229daa65bf1aa0fa (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/pages/confirm-create-reserve.tsx')
-rw-r--r--src/pages/confirm-create-reserve.tsx27
1 files changed, 16 insertions, 11 deletions
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<T>(delayMs: number, value: T): Promise<T> {
@@ -220,7 +221,7 @@ class ExchangeSelection extends ImplicitStateComponent<ExchangeSelectionProps> {
);
}
if (this.url() && !this.statusString()) {
- let shortName = URI(this.url()!).host();
+ let shortName = new URI(this.url()!).host();
return (
<i18n.Translate wrap="p">
Waiting for a response from
@@ -283,7 +284,7 @@ class ExchangeSelection extends ImplicitStateComponent<ExchangeSelectionProps> {
}
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<ExchangeSelectionProps> {
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<ExchangeSelectionProps> {
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();
+});