nativescript-browser-polyfill
Browser polyfill for NativeScript
Installation
npm i nativescript-browser-polyfill
Usage
Import the library into your JavaScript file:
;
Implements
DOM
DOM is provided with very low support, these are used for libs like pixi.js that validate type.
Image, HTMLImageElement, ImageBitmap
Image has support for loading callbacks, however the loaded uri must be passed to the src already.
const image = ;imagesrc = '';image { const src width height = image;};image;image;
Document
const element = document;const fakeContext = element;
Element
All sizes return the window size:
elementclientWidth;elementclientHeight;elementinnerWidth;elementinnerHeight;elementoffsetWidth;elementoffsetHeight;
Empty attributes that prevent libraries from crashing
elementtagName;elementaddEventListener;elementremoveEventListener;elementsetAttributeNS;elementcreateElementNS;
Node
nodeownerDocument;nodeclassName;nodeappendChild;nodeinsertBefore;noderemoveChild;nodesetAttributeNS;nodegetBoundingClientRect;
Debug flags
For debugging base64 image transformations toggle:
global__debug_browser_polyfill_image = true;
By default global.__debug_browser_polyfill_image
is false.
License
Apache License Version 2.0, January 2004