I want to get "msg.sheet" and "msg.instance_url" out of the following code:
function checkT() {
$(window).on("message", async function (event) {
let origin = event.origin || event.originalEvent.origin;
if (origin !== "https://***.***.com") return;
let msg = event.data || event.originalEvent.data;
if (msg.sheet == 'undefined') {
client.invoke('notify', 'You must login in.');
} else {
return {
sheet: msg.sheet,
instance_url: msg.instance_url
}
}
})
}
let data = checkT()
console.log(data) // {sheet: msg.sheet, instance_url: msg.instance_url}
can it be solved with promises?