live preview: https://pas2js.github.io/master/projectSantaClaus/ download project: https://pas2js.github.io/master/projectSantaClaus.rar
Note:
===
Project written by Ingemar Ragnemalm (2018) using the old pas2js ver 0.8.39 (macOS).
New version: Pas2JS Compiler version 1.5.1 [2019/10/15] for Win64 x86_64
On the previous version, we have the "Uncaught (in promise) DOMException", In modern versions of Chrome, you can’t have videos autoplay with sound enabled by default. We need a button to the user click and that will break if play doesn't return a promise (currently, play() only returns a promise in Chrome, Anyway.
I believe some changes are required in the web.pas unit:
TJSKeyboardEvent = class external name 'KeyboardEvent' (TJSUIEvent)
private
FkeyCode: Integer; external name 'keyCode'; // Read Only
Public
property keyCode: Integer read FkeyCode;
end;
TJSHTMLImageElement = class external name 'Image' (TJSHTMLElement)
Public
constructor New; overload;
end;
TJSAudio = class external name 'Audio' (TJSHTMLAudioElement)
public
constructor New; overload;
constructor New(src: String); overload;
function play: TJSAudio; overload; external name 'play';
end;