more const-ness
This commit is contained in:
parent
26695aa351
commit
1b2897c03b
@ -43,14 +43,14 @@ namespace TalerNotify {
|
|||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
let handlers = [];
|
const handlers = [];
|
||||||
|
|
||||||
let connected = false;
|
let connected = false;
|
||||||
|
|
||||||
// Hack to know when the extension is unloaded
|
// Hack to know when the extension is unloaded
|
||||||
let port;
|
let port;
|
||||||
|
|
||||||
let connect = (dh) => {
|
const connect = (dh) => {
|
||||||
port = chrome.runtime.connect();
|
port = chrome.runtime.connect();
|
||||||
port.onDisconnect.addListener(dh);
|
port.onDisconnect.addListener(dh);
|
||||||
chrome.runtime.sendMessage({type: "ping"}, () => {
|
chrome.runtime.sendMessage({type: "ping"}, () => {
|
||||||
@ -77,7 +77,7 @@ namespace TalerNotify {
|
|||||||
connect(disconectHandler);
|
connect(disconectHandler);
|
||||||
|
|
||||||
function registerHandlers() {
|
function registerHandlers() {
|
||||||
let $ = (x) => document.getElementById(x);
|
const $ = (x) => document.getElementById(x);
|
||||||
|
|
||||||
function addHandler(type, listener) {
|
function addHandler(type, listener) {
|
||||||
document.addEventListener(type, listener);
|
document.addEventListener(type, listener);
|
||||||
@ -134,14 +134,14 @@ namespace TalerNotify {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let offer = e.detail.contract_wrapper;
|
const offer = e.detail.contract_wrapper;
|
||||||
|
|
||||||
if (!offer.contract) {
|
if (!offer.contract) {
|
||||||
console.error("contract field missing");
|
console.error("contract field missing");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let msg = {
|
const msg = {
|
||||||
type: "check-repurchase",
|
type: "check-repurchase",
|
||||||
detail: {
|
detail: {
|
||||||
contract: offer.contract
|
contract: offer.contract
|
||||||
@ -161,12 +161,12 @@ namespace TalerNotify {
|
|||||||
resp.existingContractHash);
|
resp.existingContractHash);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
let uri = URI(chrome.extension.getURL("pages/confirm-contract.html"));
|
const uri = URI(chrome.extension.getURL("pages/confirm-contract.html"));
|
||||||
let params = {
|
const params = {
|
||||||
offer: JSON.stringify(offer),
|
offer: JSON.stringify(offer),
|
||||||
merchantPageUrl: document.location.href,
|
merchantPageUrl: document.location.href,
|
||||||
};
|
};
|
||||||
let target = uri.query(params).href();
|
const target = uri.query(params).href();
|
||||||
if (e.detail.replace_navigation === true) {
|
if (e.detail.replace_navigation === true) {
|
||||||
document.location.replace(target);
|
document.location.replace(target);
|
||||||
} else {
|
} else {
|
||||||
@ -183,8 +183,8 @@ namespace TalerNotify {
|
|||||||
console.log("field 'pay_url' missing in taler-execute-payment event");
|
console.log("field 'pay_url' missing in taler-execute-payment event");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let payUrl = e.detail.pay_url;
|
const payUrl = e.detail.pay_url;
|
||||||
let msg = {
|
const msg = {
|
||||||
type: "execute-payment",
|
type: "execute-payment",
|
||||||
detail: {
|
detail: {
|
||||||
H_contract: e.detail.H_contract,
|
H_contract: e.detail.H_contract,
|
||||||
|
Loading…
Reference in New Issue
Block a user