{"id":25077303,"url":"https://github.com/expo/browser-polyfill","last_synced_at":"2025-04-07T13:06:42.772Z","repository":{"id":29357588,"uuid":"120968907","full_name":"expo/browser-polyfill","owner":"expo","description":"Browser polyfill for making React Native compatible with web libs like pixi.js, three.js, phaser.js","archived":false,"fork":false,"pushed_at":"2024-04-24T08:55:09.000Z","size":1603,"stargazers_count":63,"open_issues_count":38,"forks_count":25,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-30T22:53:50.652Z","etag":null,"topics":["browser-polyfill","expo","pixi","polyfill","react","react-native","reactjs","reactnative"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/expo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-10T00:02:56.000Z","updated_at":"2025-02-11T15:50:10.000Z","dependencies_parsed_at":"2024-06-18T14:08:30.895Z","dependency_job_id":"7cc8c998-4c5a-42f0-95d9-220c020b834c","html_url":"https://github.com/expo/browser-polyfill","commit_stats":{"total_commits":49,"total_committers":7,"mean_commits":7.0,"dds":"0.22448979591836737","last_synced_commit":"36d63330cfe04a8502e7608fc65a986cec1c26aa"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expo%2Fbrowser-polyfill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expo%2Fbrowser-polyfill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expo%2Fbrowser-polyfill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expo%2Fbrowser-polyfill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/expo","download_url":"https://codeload.github.com/expo/browser-polyfill/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657281,"owners_count":20974345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser-polyfill","expo","pixi","polyfill","react","react-native","reactjs","reactnative"],"created_at":"2025-02-07T02:24:25.947Z","updated_at":"2025-04-07T13:06:42.749Z","avatar_url":"https://github.com/expo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @expo/browser-polyfill\n\nBrowser polyfill for React Native\n\n### Installation\n\n```bash\nyarn add @expo/browser-polyfill\n```\n\n### Usage\n\nImport the library into your JavaScript file:\n\n```js\nimport '@expo/browser-polyfill';\n```\n\n## Implements\n\n## DOM\n\nDOM is provided with very low support, these are used for libs like pixi.js that validate type.\n\n```js\nclass Node\nclass Element\nclass Document\nclass HTMLImageElement\nclass Image\nclass ImageBitmap\nclass HTMLVideoElement\nclass Video\nclass HTMLCanvasElement\nclass Canvas\n```\n\n### Image, HTMLImageElement, ImageBitmap\n\nImage has support for loading callbacks, however the loaded uri must be passed to the src already.\n\n```js\nconst image = new Image();\nimage.src = '';\nimage.onload = () =\u003e {\n  const { src, width, height } = image;\n};\nimage.addEventListener('loading', () =\u003e {});\nimage.addEventListener('error', () =\u003e {});\n```\n\n### Document\n\n```js\nconst element = document.createElement('div');\nconst fakeContext = element.getContext('');\n```\n\n### Element\n\n#### All sizes return the window size:\n\n```js\nelement.clientWidth;\nelement.clientHeight;\nelement.innerWidth;\nelement.innerHeight;\nelement.offsetWidth;\nelement.offsetHeight;\n```\n\n#### Empty attributes that prevent libraries from crashing\n\n```js\nelement.tagName;\nelement.addEventListener;\nelement.removeEventListener;\nelement.setAttributeNS;\nelement.createElementNS;\n```\n\n### Node\n\n```js\nnode.ownerDocument;\nnode.className;\nnode.appendChild;\nnode.insertBefore;\nnode.removeChild;\nnode.setAttributeNS;\nnode.getBoundingClientRect;\n```\n\n# External Libraries\n\nSome external node.js polyfills are added as well.\n\n## [text-encoding](https://github.com/inexorabletash/text-encoding)\n\n```\nglobal.TextEncoder\nglobal.TextDecoder\n```\n\n## [xmldom-qsa](https://github.com/zeligzhou/xmldom-qsa)\n\n```\nwindow.DOMParser\n```\n\n## [react-native-console-time-polyfill](https://github.com/MaxGraey/react-native-console-time-polyfill)\n\n```\nconsole.time(label);\nconsole.timeEnd(label);\nconsole.count(label);\n```\n\n# Debug flags\n\nFor debugging base64 image transformations toggle:\n\n```js\nglobal.__debug_browser_polyfill_image = true;\n```\n\nBy default `global.__debug_browser_polyfill_image` is false.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpo%2Fbrowser-polyfill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexpo%2Fbrowser-polyfill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpo%2Fbrowser-polyfill/lists"}