partey_workadventure/maps/starter/script.ts
2021-09-23 12:29:14 +01:00

19 lines
497 B
TypeScript

/// <reference path="../node_modules/@workadventure/iframe-api-typings/iframe_api.d.ts" />
let currentPopup: any = undefined;
const today = new Date();
const time = today.getHours() + ":" + today.getMinutes();
WA.room.onEnterZone('clock', () => {
currentPopup = WA.ui.openPopup("clockPopup","It's " + time,[]);
})
WA.room.onLeaveZone('clock', closePopUp)
function closePopUp(){
if (currentPopup !== undefined) {
currentPopup.close();
currentPopup = undefined;
}
}