aboutsummaryrefslogtreecommitdiff
path: root/src/webex/notify.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/webex/notify.ts')
-rw-r--r--src/webex/notify.ts14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/webex/notify.ts b/src/webex/notify.ts
index 0531717b8..1da8af1cd 100644
--- a/src/webex/notify.ts
+++ b/src/webex/notify.ts
@@ -49,7 +49,7 @@ if (document.documentElement.getAttribute("data-taler-nojs")) {
interface Handler {
type: string;
- listener: (e: CustomEvent) => void|Promise<void>;
+ listener: (e: Event) => void|Promise<void>;
}
const handlers: Handler[] = [];
@@ -230,13 +230,6 @@ async function processProposal(proposal: any) {
return;
}
- let merchantName = "(unknown)";
- try {
- merchantName = proposal.data.merchant.name;
- } catch (e) {
- // bad contract / name not included
- }
-
const proposalId = await wxApi.saveProposal({
contractTerms: proposal.data,
contractTermsHash: proposal.hash,
@@ -400,7 +393,10 @@ function registerHandlers() {
* handles adding sequence numbers to responses.
*/
function addHandler(type: string, handler: HandlerFn) {
- const handlerWrap = (e: CustomEvent) => {
+ const handlerWrap = (e: Event) => {
+ if (!(e instanceof CustomEvent)) {
+ throw Error(`invariant violated`);
+ }
if (e.type !== type) {
throw Error(`invariant violated`);
}