workadventure/maps/starter/script.ts

19 lines
497 B
TypeScript
Raw Normal View History

/// <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;
}
}