postmessage

This commit is contained in:
zino
2021-03-05 23:59:13 +01:00
parent a566040f3f
commit e52ebec64c
9 changed files with 989 additions and 216 deletions

47
client/src/seatmap.ts Normal file
View File

@@ -0,0 +1,47 @@
import jQuery = require("jquery");
import Utils from './utils';
// var parseString = require('xml2js').parseString;
// import axios from 'axios';
// let checkoutParams: string[];
// let posturl: string;
window.addEventListener('load', function () {
jQuery("#foobar").on("click", () => {
Utils.sendMessage({ message: "Hello from parent", date: Date.now() }, "parent");
});
});
window.addEventListener('message', function(e) {
console.log("Child: Received");
const data = JSON.parse(e.data);
console.log(data);
});
// jQuery(($) => {
// parseQueryString();
// console.log(checkoutParams);
// console.log(posturl);
// axios.get(posturl)
// .then(function (response) {
// // handle success
// console.log(response);
// })
// .catch(function (error) {
// // handle error
// console.log(error);
// });
// .then(function () {
// // always executed
// });
// });
// function parseQueryString() {
// const urlParams: URLSearchParams = new URLSearchParams(window.location.search);
// checkoutParams = JSON.parse(<string>urlParams.get('checkoutParams'));
// posturl = <string>urlParams.get('posturl');
// }