UNPKG

native-canvas

Version:

A canvas library allows for a HTML canvas to run natively on NodeJs, without a WebBrowser

1,510 lines 86.4 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); } return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var application_context_1 = require("../app/application-context"); var events_1 = require("events"); var sdl_window_opts_1 = require("./sdl-window-opts"); var sdl_context_1 = require("../sdl-context"); var messagebox_1 = require("./messagebox"); var sdl_1 = require("../sdl"); var mouse_event_1 = require("../event/mouse-event"); var key_event_1 = require("../event/key-event"); var sdl_document_1 = require("../document/sdl-document"); var sdl_canvas_1 = require("../canvas/sdl-canvas"); var sdl_navigator_1 = require("./sdl-navigator"); var sdl_performance_1 = require("../performance/sdl-performance"); var NodeCanvasImage = require('canvas').Image; var createInternalCanvas = require('canvas').createCanvas; var loadImage = require('canvas').loadImage; var SdlWindow = /** @class */ (function (_super) { __extends(SdlWindow, _super); function SdlWindow(options) { var _this = _super.call(this) || this; _this.options = options; _this._hasMouseEnteredWindow = false; _this.init(); _this._navigator = new sdl_navigator_1.SdlNavigator(_this); _this._performance = new sdl_performance_1.SdlPerformance(_this); _this.createCanvas(); application_context_1.applicationContext.registerWindow(_this); setTimeout(function () { _this.emit('load'); }, 100); return _this; } SdlWindow.prototype.disableFullScreen = function () { this.fullScreen = false; }; SdlWindow.prototype.enableFullScreen = function () { this.fullScreen = true; }; SdlWindow.prototype.windowImplementation = function () { return this; }; SdlWindow.prototype.stopPropagation = function (event) { }; SdlWindow.prototype.stopImmediatePropagation = function (event) { }; SdlWindow.prototype.preventDefault = function (event) { }; SdlWindow.prototype.addEventListener = function (type, listener, options) { switch (type) { case 'load': case 'DOMContentLoaded': this.on('load', listener); break; case 'dragstart': this.on('dropBegin', listener); break; case 'drop': this.on('drop', listener); break; case 'mouseleave': case 'mouseout': this.on('mouseleave', listener); break; case 'maximize': this.on(type, listener); break; case 'minimize': this.on(type, listener); break; case 'mouseenter': case 'mouseover': this.on('mouseenter', listener); break; case 'move': this.on(type, listener); break; case 'hide': this.on(type, listener); break; case 'show': this.on(type, listener); break; case 'resize': this.on(type, listener); break; case 'blur': this.on(type, listener); break; case 'focus': this.on(type, listener); break; case 'close': this.on(type, listener); break; case 'datachange': this.on('change', listener); break; case 'keyup': this.on(type, listener); break; case 'keydown': this.on(type, listener); break; case 'keypress': this.on(type, listener); break; case 'mousemove': this.on('mousemove', listener); break; case 'mousedown': this.on(type, listener); break; case 'mouseup': this.on(type, listener); break; case 'mousewheel': this.on(type, listener); break; case 'click': this.on(type, listener); break; } }; SdlWindow.prototype.alert = function (message) { messagebox_1.alert(message || '', this._windowPtr); }; SdlWindow.prototype.atob = function (encodedString) { return ''; }; SdlWindow.prototype.blur = function () { this.emit('blur'); }; SdlWindow.prototype.btoa = function (rawString) { return ''; }; SdlWindow.prototype.cancelAnimationFrame = function (handle) { var _this = this; this.listeners('renderFrame').forEach(function (listener) { _this.off('renderFrame', listener); }); }; SdlWindow.prototype.captureEvents = function () { }; SdlWindow.prototype.clearInterval = function (handle) { }; SdlWindow.prototype.clearTimeout = function (handle) { }; SdlWindow.prototype.confirm = function (message) { return messagebox_1.confirm(message, this._windowPtr); }; SdlWindow.prototype.createImageBitmap = function (image, sx, sy, sw, sh) { return undefined; }; SdlWindow.prototype.departFocus = function (navigationReason, origin) { }; SdlWindow.prototype.dispatchEvent = function (event) { return false; }; SdlWindow.prototype.fetch = function (input, init) { return undefined; }; SdlWindow.prototype.getComputedStyle = function (elt, pseudoElt) { return undefined; }; SdlWindow.prototype.getMatchedCSSRules = function (elt, pseudoElt) { return undefined; }; SdlWindow.prototype.getSelection = function () { return undefined; }; SdlWindow.prototype.matchMedia = function (query) { return undefined; }; SdlWindow.prototype.moveBy = function (x, y) { }; SdlWindow.prototype.moveTo = function (x, y) { }; SdlWindow.prototype.msWriteProfilerMark = function (profilerMarkName) { }; SdlWindow.prototype.open = function (url, target, features, replace) { return undefined; }; SdlWindow.prototype.postMessage = function (message, targetOrigin, transfer) { }; SdlWindow.prototype.print = function () { }; SdlWindow.prototype.prompt = function (message, _default) { return undefined; }; SdlWindow.prototype.queueMicrotask = function (callback) { }; SdlWindow.prototype.releaseEvents = function () { }; SdlWindow.prototype.removeEventListener = function (type, listener, options) { switch (type) { case 'mouseleave': case 'mouseout': this.off('mouseleave', listener); break; case 'mouseenter': case 'mouseover': this.off('mouseenter', listener); break; case 'datachange': this.off('change', listener); break; default: this.off(type, listener); break; } }; SdlWindow.prototype.requestAnimationFrame = function (callback) { this.once('renderFrame', callback); return Number.MAX_VALUE; }; SdlWindow.prototype.resizeBy = function (x, y) { }; SdlWindow.prototype.resizeTo = function (x, y) { }; SdlWindow.prototype.scroll = function (options, y) { }; SdlWindow.prototype.scrollBy = function (options, y) { }; SdlWindow.prototype.scrollTo = function (options, y) { }; SdlWindow.prototype.setInterval = function (handler, timeout) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } return setInterval(handler, timeout, args); }; SdlWindow.prototype.setTimeout = function (handler, timeout) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } return setTimeout(handler, timeout, args); }; SdlWindow.prototype.stop = function () { }; SdlWindow.prototype.webkitCancelAnimationFrame = function (handle) { this.cancelAnimationFrame(handle); }; SdlWindow.prototype.webkitConvertPointFromNodeToPage = function (node, pt) { return undefined; }; SdlWindow.prototype.webkitConvertPointFromPageToNode = function (node, pt) { return undefined; }; SdlWindow.prototype.webkitRequestAnimationFrame = function (callback) { return this.requestAnimationFrame(callback); }; Object.defineProperty(SdlWindow.prototype, "canvasWidth", { get: function () { return this._context.width; }, set: function (val) { if (this.options.scaleCanvasToWindowSize) { var size = this.size; this.size = size = { w: val, h: size.h }; } else if (this.options.fitCanvasInWindow) { var size = this.size; this.size = size = { w: val, h: size.h }; this._internalCanvas.width = size.w; } else { this._internalCanvas.width = val; } }, enumerable: true, configurable: true }); SdlWindow.prototype.configureCanvasSize = function (w, h) { if (this.options.fitCanvasInWindow) { this._internalCanvas.width = this.size.w; this._internalCanvas.height = this.size.h; } else { this._internalCanvas.width = w; this._internalCanvas.height = h; } }; Object.defineProperty(SdlWindow.prototype, "canvasHeight", { get: function () { return this._context.height; }, set: function (val) { if (this.options.scaleCanvasToWindowSize) { var size = this.size; this.size = size = { w: size.w, h: val }; } else if (this.options.fitCanvasInWindow) { var size = this.size; this.size = size = { w: size.w, h: val }; this._internalCanvas.height = size.h; } else { this._internalCanvas.height = val; } }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "canvasY", { set: function (y) { if (this.options.fitCanvasInWindow) { this._context.y = 0; } else { this._context.y = y; } }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "canvasX", { get: function () { return this._context.x; }, set: function (x) { if (this.options.fitCanvasInWindow) { this._context.x = 0; } else { this._context.x = x; } }, enumerable: true, configurable: true }); SdlWindow.prototype.getCanvas = function () { return this._canvas; }; SdlWindow.prototype.renderFrame = function (ms) { this.emit('renderFrame', ms); var canvas = this._internalCanvas; var width = canvas.width, height = canvas.height; var size = this.size; var buffer = canvas.toBuffer('raw'); // ARGB32 // console.time('renderFrame'); this._context.renderFrame(buffer, width, height); // this._context.renderFrame(buffer, width, height); // console.timeEnd('renderFrame'); }; SdlWindow.prototype.init = function () { var sdlOpts = sdl_window_opts_1.getSdlWindowOptions(this.options); // Create the window, and store its pointer; this._windowPtr = sdl_1.SDL_CreateWindow(sdlOpts.title, sdlOpts.x, sdlOpts.y, sdlOpts.w, sdlOpts.h, sdlOpts.flags); // this.windowSurface = SDL_GetWindowSurface(this.windowPtr); // Create a SDL Context to handle the abstractions this._context = sdl_context_1.createSdlContext2D(this._windowPtr); // this._context = createSoftwareSdlContext2D(this._windowPtr); this.initSize(); this.initContextSize(); this._document = new sdl_document_1.SdlDocument(this); this.initEvents(); }; SdlWindow.prototype.initCanvasColors = function () { var ctx = this._internalCanvas.getContext('2d'); ctx.fillStyle = '#FFFFFF'; ctx.strokeStyle = '#000000'; ctx.fillRect(0, 0, this._internalCanvas.width, this._internalCanvas.height); ctx.fillStyle = '#000000'; ctx.strokeStyle = '#000000'; }; SdlWindow.prototype.initWindowEvents = function () { var _this = this; this.on('sdlEvent', function (event) { if (event.type === sdl_1.SDL_EventType.SDL_WINDOWEVENT) { var evt = event.window.event; if (evt === sdl_1.SDL_WindowEventID.SDL_WINDOWEVENT_SHOWN) { _this.emit('show'); } else if (evt === sdl_1.SDL_WindowEventID.SDL_WINDOWEVENT_HIDDEN) { _this.emit('hide'); } else if (evt === sdl_1.SDL_WindowEventID.SDL_WINDOWEVENT_EXPOSED) { // this.triggerWindowSizeChange(); } else if (evt === sdl_1.SDL_WindowEventID.SDL_WINDOWEVENT_MOVED) { _this.emit('move', event.window.data1, event.window.data2); } else if (evt === sdl_1.SDL_WindowEventID.SDL_WINDOWEVENT_RESIZED) { _this.triggerWindowSizeChange(); _this.emit('resize', event.window.data1, event.window.data2); } else if (evt === sdl_1.SDL_WindowEventID.SDL_WINDOWEVENT_SIZE_CHANGED) { // this._change(event.window.data1, event.window.data2); } else if (evt === sdl_1.SDL_WindowEventID.SDL_WINDOWEVENT_MINIMIZED) { _this.emit('minimize'); } else if (evt === sdl_1.SDL_WindowEventID.SDL_WINDOWEVENT_MAXIMIZED) { _this.emit('maximize'); } else if (evt === sdl_1.SDL_WindowEventID.SDL_WINDOWEVENT_RESTORED) { _this.emit('restore'); } else if (evt === sdl_1.SDL_WindowEventID.SDL_WINDOWEVENT_ENTER) { _this._hasMouseEnteredWindow = true; } else if (evt === sdl_1.SDL_WindowEventID.SDL_WINDOWEVENT_LEAVE) { if (_this._lastMouseEvent) { _this.emit('mouseleave', _this._lastMouseEvent); } _this._hasMouseEnteredWindow = false; } else if (evt === sdl_1.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_GAINED) { _this.emit('focus'); } else if (evt === sdl_1.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_LOST) { _this.emit('blur'); } else if (evt === sdl_1.SDL_WindowEventID.SDL_WINDOWEVENT_CLOSE) { _this.close(); } } }); }; SdlWindow.prototype.initKeyEvents = function () { var _this = this; this.on('sdlEvent', function (event) { if (event.type === sdl_1.SDL_EventType.SDL_KEYDOWN) { var domEvent = key_event_1.getCurrentKeyEvent(event, _this); _this.emit('keydown', domEvent); _this._lastKeyboardEvent = domEvent; } else if (event.type === sdl_1.SDL_EventType.SDL_KEYUP) { var domEvent = key_event_1.getCurrentKeyEvent(event, _this); _this.emit('keyup', domEvent); _this._lastKeyboardEvent = null; } else if (event.type === sdl_1.SDL_EventType.SDL_TEXTINPUT) { var buf = Buffer.from(event.text.text); var str = buf.reinterpretUntilZeros(1).toString(); var domEvent = key_event_1.getCurrentKeyEvent(event, _this); domEvent.key = str; domEvent.keyCode = domEvent.charCode = str.codePointAt(0); domEvent.ctrlKey = _this._lastKeyboardEvent.ctrlKey; domEvent.shiftKey = _this._lastKeyboardEvent.shiftKey; domEvent.altKey = _this._lastKeyboardEvent.altKey; domEvent.metaKey = _this._lastKeyboardEvent.metaKey; _this.emit('keypress', domEvent); } }); }; SdlWindow.prototype.initDragAndDropEvents = function () { var _this = this; this.on('sdlEvent', function (event) { if (event.type === sdl_1.SDL_EventType.SDL_DROPFILE) { // this.emit('dropFile', event.drop.file); var drop = event.drop; var data = { file: event.drop.file }; _this.emit('drop', data); } else if (event.type === sdl_1.SDL_EventType.SDL_DROPBEGIN) { _this.emit('dropBegin', event.drop.file); } else if (event.type === sdl_1.SDL_EventType.SDL_DROPCOMPLETE) { _this.emit('dropDone', event.drop.file); } else if (event.type === sdl_1.SDL_EventType.SDL_CLIPBOARDUPDATE) { _this.emit('clipboard'); } }); }; SdlWindow.prototype.initMouseEvents = function () { var _this = this; this.on('sdlEvent', function (event) { if (event.type === sdl_1.SDL_EventType.SDL_MOUSEMOTION) { var domEvent = mouse_event_1.getCurrentMouseEvent(event, _this); _this.decorateMouseEvent(domEvent); if (_this._hasMouseEnteredWindow) { _this.emit('mouseenter', domEvent); _this._hasMouseEnteredWindow = false; } _this.emit('mousemove', domEvent); _this._lastMouseEvent = domEvent; } else if (event.type === sdl_1.SDL_EventType.SDL_MOUSEBUTTONDOWN) { var domEvent = mouse_event_1.getCurrentMouseEvent(event, _this); _this.emit('mousedown', domEvent); } else if (event.type === sdl_1.SDL_EventType.SDL_MOUSEBUTTONUP) { var domEvent = mouse_event_1.getCurrentMouseEvent(event, _this); _this.emit('mouseup', domEvent); _this.emit('click', domEvent); } }); }; SdlWindow.prototype.decorateMouseEvent = function (event) { var castedEvent = event; if (this._lastKeyboardEvent) { castedEvent.altKey = this._lastKeyboardEvent.altKey; castedEvent.ctrlKey = this._lastKeyboardEvent.ctrlKey; castedEvent.shiftKey = this._lastKeyboardEvent.shiftKey; castedEvent.metaKey = this._lastKeyboardEvent.metaKey; } }; SdlWindow.prototype.initEvents = function () { this.initWindowEvents(); this.initMouseEvents(); this.initKeyEvents(); this.initDragAndDropEvents(); }; SdlWindow.prototype.initContextSize = function () { var size = this.size; this._context.setSize(size.w, size.h); }; SdlWindow.prototype.initSize = function () { this.size = sdl_1.SDL_GetWindowSize(this._windowPtr); }; SdlWindow.prototype.triggerWindowSizeChange = function () { this.initSize(); if (!this.options.scaleCanvasToWindowSize) { this.initContextSize(); } var size = this.size; this.initCanvasSize(size); this.emit('change', size.w, size.h); }; SdlWindow.prototype.grab = function () { sdl_1.SDL_SetWindowGrab(this._windowPtr, true); }; SdlWindow.prototype.focus = function () { sdl_1.SDL_RaiseWindow(this._windowPtr); }; SdlWindow.prototype.close = function () { if (!this.options.closable) { return; } this.destroy(); }; SdlWindow.prototype.destroy = function () { // this.rendererPtr.destroy(); sdl_1.SDL_DestroyWindow(this._windowPtr); this.emit('_closed'); }; SdlWindow.prototype.restore = function () { sdl_1.SDL_RestoreWindow(this._windowPtr); }; SdlWindow.prototype.center = function () { this.position = [0x2FFF0000, 0x2FFF0000]; }; SdlWindow.prototype.setModal = function (win) { if (win && win._windowPtr) { sdl_1.SDL_SetWindowModalFor(win._windowPtr, this._windowPtr); } }; Object.defineProperty(SdlWindow.prototype, "maximize", { get: function () { /*tslint:disable*/ return !!(sdl_1.SDL_GetWindowFlags(this._windowPtr) & sdl_1.SDL_WindowFlags.SDL_WINDOW_MAXIMIZED); /*tslint:enable*/ }, set: function (_maximized) { if (!!_maximized) { sdl_1.SDL_MaximizeWindow(this._windowPtr); } else if (this.maximize) { this.restore(); } }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "minimize", { get: function () { /*tslint:disable*/ return !!(sdl_1.SDL_GetWindowFlags(this._windowPtr) & sdl_1.SDL_WindowFlags.SDL_WINDOW_MINIMIZED); /*tslint:enable*/ }, set: function (_minimized) { if (!!_minimized) { sdl_1.SDL_MinimizeWindow(this._windowPtr); } else if (this.minimize) { this.restore(); } }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "fullScreen", { get: function () { /*tslint:disable*/ return !!(sdl_1.SDL_GetWindowFlags(this._windowPtr) & sdl_1.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN); /*tslint:enable*/ }, set: function (full) { if (full) { sdl_1.SDL_SetWindowFullscreen(this._windowPtr, sdl_1.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP); } else { sdl_1.SDL_SetWindowFullscreen(this._windowPtr, 0); } }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "bounds", { get: function () { var position = this.position; var size = this.size; return { x: position.x, y: position.y, w: size.w, h: size.h }; }, set: function (rect) { this.position = rect; this.size = rect; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "size", { get: function () { return this._size; }, set: function (val) { this._size = val; sdl_1.SDL_SetWindowSize(this._windowPtr, val.w, val.h); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "minimumSize", { get: function () { return sdl_1.SDL_GetWindowMinimumSize(this._windowPtr); }, set: function (wh) { var size = this.minimumSize; var w = wh.w >= 0 ? wh.w : (wh[0] >= 0 ? wh[0] : size.w); var h = wh.h >= 0 ? wh.h : (wh[1] >= 0 ? wh[1] : size.h); sdl_1.SDL_SetWindowMinimumSize(this._windowPtr, w, h); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "maximumSize", { get: function () { return sdl_1.SDL_GetWindowMaximumSize(this._windowPtr); }, set: function (wh) { var size = this.maximumSize; var w = wh.w >= 0 ? wh.w : (wh[0] >= 0 ? wh[0] : size.w); var h = wh.h >= 0 ? wh.h : (wh[1] >= 0 ? wh[1] : size.h); sdl_1.SDL_SetWindowMaximumSize(this._windowPtr, w, h); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "resizable", { get: function () { /*tslint:disable*/ return !!(sdl_1.SDL_GetWindowFlags(this._windowPtr) & sdl_1.SDL_WindowFlags.SDL_WINDOW_RESIZABLE); /*tslint:enable*/ }, set: function (value) { sdl_1.SDL_SetWindowResizable(this._windowPtr, value); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "closable", { get: function () { return this.options.closable; }, set: function (_closable) { this.options.closable = !!_closable; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "position", { get: function () { return sdl_1.SDL_GetWindowPosition(this._windowPtr); }, set: function (xy) { var position = this.position; var x = xy.x >= 0 ? xy.x : (xy[0] >= 0 ? xy[0] : position.x); var y = xy.y >= 0 ? xy.y : (xy[1] >= 0 ? xy[1] : position.y); sdl_1.SDL_SetWindowPosition(this._windowPtr, x, y); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "title", { get: function () { return sdl_1.SDL_GetWindowTitle(this._windowPtr); }, set: function (title) { sdl_1.SDL_SetWindowTitle(this._windowPtr, title); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "border", { set: function (border) { sdl_1.SDL_SetWindowBordered(this._windowPtr, !!border); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "bordersSize", { get: function () { return sdl_1.SDL_GetWindowBordersSize(this._windowPtr); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "show", { get: function () { /*tslint:disable*/ return !!(sdl_1.SDL_GetWindowFlags(this._windowPtr) & sdl_1.SDL_WindowFlags.SDL_WINDOW_SHOWN); /*tslint:enable*/ }, set: function (show) { if (show) { sdl_1.SDL_ShowWindow(this._windowPtr); } else { sdl_1.SDL_HideWindow(this._windowPtr); } }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "id", { get: function () { return sdl_1.SDL_GetWindowID(this._windowPtr); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "windowPtr", { get: function () { return this._windowPtr; }, set: function (value) { this._windowPtr = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "hasMouseEnteredWindow", { get: function () { return this._hasMouseEnteredWindow; }, set: function (value) { this._hasMouseEnteredWindow = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "lastMouseEvent", { get: function () { return this._lastMouseEvent; }, set: function (value) { this._lastMouseEvent = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "lastKeyboardEvent", { get: function () { return this._lastKeyboardEvent; }, set: function (value) { this._lastKeyboardEvent = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "context", { get: function () { return this._context; }, set: function (value) { this._context = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "internalCanvas", { get: function () { return this._internalCanvas; }, set: function (value) { this._internalCanvas = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "Blob", { get: function () { return this._Blob; }, set: function (value) { this._Blob = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "URL", { get: function () { return this._URL; }, set: function (value) { this._URL = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "URLSearchParams", { get: function () { return this._URLSearchParams; }, set: function (value) { this._URLSearchParams = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "customElements", { get: function () { return this._customElements; }, set: function (value) { this._customElements = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "defaultStatus", { get: function () { return this._defaultStatus; }, set: function (value) { this._defaultStatus = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "location", { get: function () { return this._location; }, set: function (value) { this._location = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "name", { get: function () { return this._name; }, set: function (value) { this._name = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "offscreenBuffering", { get: function () { return this._offscreenBuffering; }, set: function (value) { this._offscreenBuffering = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onabort", { get: function () { return this._onabort; }, set: function (value) { this._onabort = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onafterprint", { get: function () { return this._onafterprint; }, set: function (value) { this._onafterprint = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onanimationcancel", { get: function () { return this._onanimationcancel; }, set: function (value) { this._onanimationcancel = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onanimationend", { get: function () { return this._onanimationend; }, set: function (value) { this._onanimationend = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onanimationiteration", { get: function () { return this._onanimationiteration; }, set: function (value) { this._onanimationiteration = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onanimationstart", { get: function () { return this._onanimationstart; }, set: function (value) { this._onanimationstart = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onauxclick", { get: function () { return this._onauxclick; }, set: function (value) { this._onauxclick = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onbeforeprint", { get: function () { return this._onbeforeprint; }, set: function (value) { this._onbeforeprint = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onbeforeunload", { get: function () { return this._onbeforeunload; }, set: function (value) { this._onbeforeunload = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onblur", { get: function () { return this._onblur; }, set: function (value) { this._onblur = value; this.addEventListener('blur', value, false); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "oncancel", { get: function () { return this._oncancel; }, set: function (value) { this._oncancel = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "oncanplay", { get: function () { return this._oncanplay; }, set: function (value) { this._oncanplay = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "oncanplaythrough", { get: function () { return this._oncanplaythrough; }, set: function (value) { this._oncanplaythrough = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onchange", { get: function () { return this._onchange; }, set: function (value) { this._onchange = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onclick", { get: function () { return this._onclick; }, set: function (value) { this._onclick = value; this.addEventListener('click', value, false); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onclose", { get: function () { return this._onclose; }, set: function (value) { this.addEventListener('close', value, false); this._onclose = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "oncompassneedscalibration", { get: function () { return this._oncompassneedscalibration; }, set: function (value) { this._oncompassneedscalibration = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "oncontextmenu", { get: function () { return this._oncontextmenu; }, set: function (value) { this._oncontextmenu = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "oncuechange", { get: function () { return this._oncuechange; }, set: function (value) { this._oncuechange = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "ondblclick", { get: function () { return this._ondblclick; }, set: function (value) { this._ondblclick = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "ondevicelight", { get: function () { return this._ondevicelight; }, set: function (value) { this._ondevicelight = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "ondevicemotion", { get: function () { return this._ondevicemotion; }, set: function (value) { this._ondevicemotion = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "ondeviceorientation", { get: function () { return this._ondeviceorientation; }, set: function (value) { this._ondeviceorientation = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "ondrag", { get: function () { return this._ondrag; }, set: function (value) { this._ondrag = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "ondragend", { get: function () { return this._ondragend; }, set: function (value) { this._ondragend = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "ondragenter", { get: function () { return this._ondragenter; }, set: function (value) { this._ondragenter = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "ondragexit", { get: function () { return this._ondragexit; }, set: function (value) { this._ondragexit = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "ondragleave", { get: function () { return this._ondragleave; }, set: function (value) { this._ondragleave = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "ondragover", { get: function () { return this._ondragover; }, set: function (value) { this._ondragover = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "ondragstart", { get: function () { return this._ondragstart; }, set: function (value) { this._ondragstart = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "ondrop", { get: function () { return this._ondrop; }, set: function (value) { this._ondrop = value; this.addEventListener('drop', value, false); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "ondurationchange", { get: function () { return this._ondurationchange; }, set: function (value) { this._ondurationchange = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onemptied", { get: function () { return this._onemptied; }, set: function (value) { this._onemptied = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onended", { get: function () { return this._onended; }, set: function (value) { this._onended = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onerror", { get: function () { return this._onerror; }, set: function (value) { this._onerror = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onfocus", { get: function () { return this._onfocus; }, set: function (value) { this._onfocus = value; this.addEventListener('focus', value, false); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "ongotpointercapture", { get: function () { return this._ongotpointercapture; }, set: function (value) { this._ongotpointercapture = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onhashchange", { get: function () { return this._onhashchange; }, set: function (value) { this._onhashchange = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "oninput", { get: function () { return this._oninput; }, set: function (value) { this._oninput = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "oninvalid", { get: function () { return this._oninvalid; }, set: function (value) { this._oninvalid = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onkeydown", { get: function () { return this._onkeydown; }, set: function (value) { this._onkeydown = value; this.addEventListener('keydown', value, false); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onkeypress", { get: function () { return this._onkeypress; }, set: function (value) { this._onkeypress = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onkeyup", { get: function () { return this._onkeyup; }, set: function (value) { this._onkeyup = value; this.addEventListener('keyup', value, false); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onlanguagechange", { get: function () { return this._onlanguagechange; }, set: function (value) { this._onlanguagechange = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onload", { get: function () { return this._onload; }, set: function (value) { this._onload = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onloadeddata", { get: function () { return this._onloadeddata; }, set: function (value) { this._onloadeddata = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onloadedmetadata", { get: function () { return this._onloadedmetadata; }, set: function (value) { this._onloadedmetadata = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onloadend", { get: function () { return this._onloadend; }, set: function (value) { this._onloadend = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onloadstart", { get: function () { return this._onloadstart; }, set: function (value) { this._onloadstart = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onlostpointercapture", { get: function () { return this._onlostpointercapture; }, set: function (value) { this._onlostpointercapture = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onmessage", { get: function () { return this._onmessage; }, set: function (value) { this._onmessage = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onmessageerror", { get: function () { return this._onmessageerror; }, set: function (value) { this._onmessageerror = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onmousedown", { get: function () { return this._onmousedown; }, set: function (value) { this._onmousedown = value; this.addEventListener('mousedown', value, false); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onmouseenter", { get: function () { return this._onmouseenter; }, set: function (value) { this._onmouseenter = value; this.addEventListener('mouseenter', value, false); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onmouseleave", { get: function () { return this._onmouseleave; }, set: function (value) { this._onmouseleave = value; this.addEventListener('mouseleave', value, false); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onmousemove", { get: function () { return this._onmousemove; }, set: function (value) { this._onmousemove = value; this.addEventListener('mousemove', value, false); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onmouseout", { get: function () { return this._onmouseout; }, set: function (value) { this._onmouseout = value; this.addEventListener('mouseout', value, false); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onmouseover", { get: function () { return this._onmouseover; }, set: function (value) { this._onmouseover = value; this.addEventListener('mouseover', value, false); }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onmouseup", { get: function () { return this._onmouseup; }, set: function (value) { this.addEventListener('mouseup', value, false); this._onmouseup = value; }, enumerable: true, configurable: true }); Object.defineProperty(SdlWindow.prototype, "onmousewheel", { get: function () { return this._onmousewheel; }, set: function (value) { this.addEventListener('mousewheel', value, false); this._onmousewheel = value; }, enumerable: true, configurable: true }); Object