diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-09-22 15:09:18 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-09-22 15:09:18 +0200 |
commit | 4974dd19c02778f0c58fad6cd12e839c9164e00d (patch) | |
tree | 69198fc1d53cb595ed1cb393e86ac7ef0038a309 /popup/popup.tsx | |
parent | 903bb780dea2a4c538d2ffde3ba5a0a7f4497050 (diff) | |
parent | fca125a0da491e1753d2902d21a672559936922b (diff) |
Merge branch 'master' of git+ssh://taler.net/var/git/wallet-webex
Diffstat (limited to 'popup/popup.tsx')
-rw-r--r-- | popup/popup.tsx | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/popup/popup.tsx b/popup/popup.tsx index a818e9228..fa222125f 100644 --- a/popup/popup.tsx +++ b/popup/popup.tsx @@ -29,12 +29,15 @@ "use strict"; import {substituteFulfillmentUrl} from "../lib/wallet/helpers"; +import BrowserClickedEvent = chrome.browserAction.BrowserClickedEvent; +import {Wallet} from "../lib/wallet/wallet"; +import {AmountJson} from "../lib/wallet/types"; declare var m: any; declare var i18n: any; -function onUpdateNotification(f) { +function onUpdateNotification(f: () => void) { let port = chrome.runtime.connect({name: "notifications"}); port.onMessage.addListener((msg, port) => { f(); @@ -56,7 +59,7 @@ export function main() { console.log("this is popup"); -function makeTab(target, name) { +function makeTab(target: string, name: string) { let cssClass = ""; if (target == m.route()) { cssClass = "active"; @@ -79,8 +82,8 @@ namespace WalletNavBar { } -function openInExtension(element, isInitialized) { - element.addEventListener("click", (e) => { +function openInExtension(element: HTMLAnchorElement, isInitialized: boolean) { + element.addEventListener("click", (e: Event) => { chrome.tabs.create({ "url": element.href }); @@ -88,13 +91,15 @@ function openInExtension(element, isInitialized) { }); } + + namespace WalletBalance { export function controller() { return new Controller(); } class Controller { - myWallet; + myWallet: any; gotError = false; constructor() { @@ -128,7 +133,7 @@ namespace WalletBalance { if (!wallet) { throw Error("Could not retrieve wallet"); } - let listing = _.map(wallet, x => m("p", formatAmount(x))); + let listing = _.map(wallet, (x: any) => m("p", formatAmount(x))); if (listing.length > 0) { return listing; } @@ -141,13 +146,13 @@ namespace WalletBalance { } -function formatTimestamp(t) { +function formatTimestamp(t: number) { let x = new Date(t); return x.toLocaleString(); } -function formatAmount(amount) { +function formatAmount(amount: AmountJson) { let v = amount.value + amount.fraction / 1e6; return `${v.toFixed(2)} ${amount.currency}`; } @@ -158,7 +163,7 @@ function abbrevKey(s: string) { } -function retryPayment(url, contractHash) { +function retryPayment(url: string, contractHash: string) { return function() { chrome.tabs.create({ "url": substituteFulfillmentUrl(url, @@ -168,7 +173,7 @@ function retryPayment(url, contractHash) { } -function formatHistoryItem(historyItem) { +function formatHistoryItem(historyItem: any) { const d = historyItem.detail; const t = historyItem.timestamp; console.log("hist item", historyItem); @@ -210,7 +215,7 @@ namespace WalletHistory { } class Controller { - myHistory; + myHistory: any; gotError = false; constructor() { @@ -287,7 +292,7 @@ var WalletDebug = { }; -function openExtensionPage(page) { +function openExtensionPage(page: string) { return function() { chrome.tabs.create({ "url": chrome.extension.getURL(page) @@ -296,7 +301,7 @@ function openExtensionPage(page) { } -function openTab(page) { +function openTab(page: string) { return function() { chrome.tabs.create({ "url": page |