revised communication
This commit is contained in:
@@ -12,14 +12,6 @@ export function sendMessage(inData: I.Message, inTo: string): void {
|
|||||||
child.contentWindow.postMessage(JSON.stringify(inData), "*");
|
child.contentWindow.postMessage(JSON.stringify(inData), "*");
|
||||||
else
|
else
|
||||||
console.log(`Element with ID ${inTo} does not exist`);
|
console.log(`Element with ID ${inTo} does not exist`);
|
||||||
|
|
||||||
// if (child === null) {
|
|
||||||
// console.log(`Element with ID ${inTo} does not exist`);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (child.contentWindow !== null)
|
|
||||||
// child.contentWindow.postMessage(JSON.stringify(inData), "*")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +21,7 @@ export function listenToMessages(inHandler: CallableFunction): void {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sendXML(inUrl: string, inTo: string, inEvent: string, inFrom: string, inDate: number = Date.now()) {
|
export function sendXML(inUrl: string, inTo: string, inEvent: string, inFrom: string, inDate: number = Date.now()): void {
|
||||||
xml.getXMLPromise(inUrl).then((result: unknown): void => {
|
xml.getXMLPromise(inUrl).then((result: unknown): void => {
|
||||||
const message: I.Message = {
|
const message: I.Message = {
|
||||||
date: inDate,
|
date: inDate,
|
||||||
@@ -38,12 +30,13 @@ export function sendXML(inUrl: string, inTo: string, inEvent: string, inFrom: st
|
|||||||
event: inEvent
|
event: inEvent
|
||||||
}
|
}
|
||||||
sendMessage(message, inTo);
|
sendMessage(message, inTo);
|
||||||
}).catch(function (err) {
|
})
|
||||||
|
.catch(function (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sendEventToChild(inEvent: string) {
|
export function sendEventToChild(inEvent: string): void {
|
||||||
const message: I.Message = {
|
const message: I.Message = {
|
||||||
message: null,
|
message: null,
|
||||||
from: "parent",
|
from: "parent",
|
||||||
@@ -53,7 +46,7 @@ export function sendEventToChild(inEvent: string) {
|
|||||||
sendMessage(message, "iframeSeatmap");
|
sendMessage(message, "iframeSeatmap");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sendEventToParent(inEvent: string) {
|
export function sendEventToParent(inEvent: string): void {
|
||||||
const message: I.Message = {
|
const message: I.Message = {
|
||||||
message: null,
|
message: null,
|
||||||
from: "child",
|
from: "child",
|
||||||
@@ -63,7 +56,7 @@ export function sendEventToParent(inEvent: string) {
|
|||||||
sendMessage(message, "parent");
|
sendMessage(message, "parent");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function needSeatmapXML(inID: string) {
|
export function needSeatmapXML(inID: string): void {
|
||||||
const message: I.Message = {
|
const message: I.Message = {
|
||||||
message: inID,
|
message: inID,
|
||||||
from: "child",
|
from: "child",
|
||||||
@@ -73,14 +66,14 @@ export function needSeatmapXML(inID: string) {
|
|||||||
sendMessage(message, "parent");
|
sendMessage(message, "parent");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function cancelCheckout(inUrl: string) {
|
export function cancelCheckout(inUrl: string): void {
|
||||||
// use fetch instead of axios because of 302 redirect
|
// use fetch instead of axios because of 302 redirect
|
||||||
// see https://github.com/axios/axios/issues/932
|
// see https://github.com/axios/axios/issues/932
|
||||||
fetch(inUrl, {
|
fetch(inUrl, {
|
||||||
redirect: "manual"
|
redirect: "manual"
|
||||||
}).then(() => {
|
})
|
||||||
console.log(`${inUrl} canceled`);
|
.then(() => console.log(`${inUrl} canceled`))
|
||||||
}).catch(function (error) {
|
.catch(function (error) {
|
||||||
console.log("error");
|
console.log("error");
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user