{"id":13534227,"url":"https://github.com/phoboslab/Ejecta","last_synced_at":"2025-04-01T22:31:19.223Z","repository":{"id":47653216,"uuid":"5950748","full_name":"phoboslab/Ejecta","owner":"phoboslab","description":"A Fast, Open Source JavaScript, Canvas \u0026 Audio Implementation for iOS","archived":false,"fork":false,"pushed_at":"2021-06-22T17:04:00.000Z","size":133404,"stargazers_count":2812,"open_issues_count":49,"forks_count":319,"subscribers_count":135,"default_branch":"master","last_synced_at":"2025-03-30T12:04:15.538Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phoboslab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-25T13:54:24.000Z","updated_at":"2025-03-25T02:47:03.000Z","dependencies_parsed_at":"2022-09-23T15:52:32.027Z","dependency_job_id":null,"html_url":"https://github.com/phoboslab/Ejecta","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phoboslab%2FEjecta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phoboslab%2FEjecta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phoboslab%2FEjecta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phoboslab%2FEjecta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phoboslab","download_url":"https://codeload.github.com/phoboslab/Ejecta/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246720542,"owners_count":20822914,"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":[],"created_at":"2024-08-01T07:01:28.440Z","updated_at":"2025-04-01T22:31:18.753Z","avatar_url":"https://github.com/phoboslab.png","language":"Objective-C","readme":"# Ejecta\n\nEjecta is a fast, open source JavaScript, Canvas \u0026 Audio implementation for iOS (iPhone, iPod Touch, iPad) and tvOS (Apple TV). Think of it as a Browser that can only display a Canvas element.\n\nMore info \u0026 Documentation: http://impactjs.com/ejecta\n\nEjecta is published under the [MIT Open Source License](http://opensource.org/licenses/mit-license.php).\n\n\n## Quick Start\n\n1. Create a folder called `App` within this Xcode project\n2. Copy your canvas application into the `App` folder\n3. Ensure you have at least 1 file named `index.js`\n4. Build the Xcode project\n\nFor an example application, copy `./index.js` into the `App` folder.\n\n## Recent Breaking Changes\n\n### 2016-06-23 - Typed Arrays are fast again!\n\nThe JSC version that comes with iOS 10 provides a new API to read and write Typed Arrays in native code. The workaround from previous versions is not needed anymore\n\n### 2016-06-23 - Removed iAds\n\nApple will discontinue its own iAd Network on June 30. The iAd-Banner API has been removed from Ejecta.\n\n### 2015-12-12 - Use OS provided JavaScriptCore library \n\nSince [08741b4](https://github.com/phoboslab/Ejecta/commit/08741b4489ff945b117ebee0333c7eb7a6177c2e) Ejecta uses the JSC lib provided by iOS and tvOS instead of bundling a custom fork of it. This mainly means two things: The resulting binary will be much smaller and reading/writing of Typed Arrays is much slower.\n\nThis only affects WebGL and the `get/setImageData()` functions for Canvas2D. Some tests indicate that the performance is still good enough for most WebGL games. On 64bit systems it's highly optimized to take about 7ms/Megabyte for reading and about 20ms/Megabyte for writing. It's much slower on 32bit systems, though.\n\nMore info about this change can be found [in my blog](http://phoboslab.org/log/2015/11/the-absolute-worst-way-to-read-typed-array-data-with-javascriptcore). Please comment on [this Webkit bug](https://bugs.webkit.org/show_bug.cgi?id=120112) if you want to have fast Typed Array support again.\n\n### 2015-11-27 – Allowed orientation change\n\nAllowed interface orientations should now be set using the \"Device Orientation\" checkboxes in the Project's General settings. Ejecta now rotates to all allowed orientations automatically. If the window size changes due to a rotation (i.e. when rotating from landscape to portrait or vice versa), the window's `resize` event is fired.\n\n```javascript\nwindow.addEventListener('resize', function() {\n\t// Resize your screen canvas here if needed.\n\tconsole.log('new window size:', window.innerWidth, window.innerHeight);\n});\n```\n\n### 2015-11-09 - Moved Antialias (MSAA) settings to getContext options\n\nThe `canvas.MSAAEnabled` and `canvas.MSAASamples` properties have been removed. Instead, you can now specify antialias settings in a separate options object when calling `getContext()`, similar to how it works in a browser. Antialias now works on 2D and WebGL contexts.\n\nNote that for 2D contexts antialias will have no effect when drawing images, other than slowing down performance. It only makes sense to enable antialias if you draw shapes and paths.\n\n```javascript\nvar gl = canvas.getContext('webgl', {antialias: true, antialiasSamples: 4});\n\n// Or for 2d contexts\n\nvar ctx = canvas.getContext('2d', {antialias: true, antialiasSamples: 4});\n```\n\n### 2015-11-08 - Removed automatic pixel doubling for retina devices\n\nThe Canvas' backing store is now exactly the same size as the `canvas.width` and `canvas.height`. Ejecta *does not* automatically double the internal resolution on retina devices anymore. The `ctx.backingStorePixelRatio` and `canvas.retinaResolutionEnabled` properties as well as the `HD` variants for the `ctx.getImageData`, `ctx.putImageData` and `ctx.createImageData` functions have been removed.\n\nYou can of course still render in retina resolution, by setting the `width` and `height` to the retina resolution while forcing the `style` to scale the canvas to the logical display resolution. This is in line with current browsers.\n\n ```javascript\ncanvas.width = window.innerWidth * window.devicePixelRatio;\ncanvas.height = window.innerHeight * window.devicePixelRatio;\ncanvas.style.width = window.innerWidth + 'px';\ncanvas.style.height = window.innerHeight + 'px';\n\n// For 2D contexts you may want to zoom in afterwards\nctx.scale( window.devicePixelRatio, window.devicePixelRatio );\n```\n\n\n## WebGL Support\n\nEjecta supports WebGL out of the box, alongside with Canvas2D. You can create WebGL textures from Canvas2D instances and also draw WebGL Canvases into 2D Contexts as images. Note that you can't change the \"mode\" (2D or WebGL) of a Context after it has been created.\n\n\n## Three.js on iOS with Ejecta \n\nEjecta always creates the screen Canvas element for you. You have to hand this Canvas element over to Three.js instead of letting it create its own.\n\n```javascript\nrenderer = new THREE.WebGLRenderer( {canvas: document.getElementById('canvas')} );\n```\n\nAn example App folder with the Three.js [Walt CubeMap demo](http://mrdoob.github.com/three.js/examples/webgl_materials_cubemap.html) can be found here:\n\nhttp://phoboslab.org/files/Ejecta-ThreeJS-CubeMap.zip\n","funding_links":[],"categories":["Libraries","Objective-C","Objective-C  Stars 1000以内排名整理"],"sub_categories":["JavaScript"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphoboslab%2FEjecta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphoboslab%2FEjecta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphoboslab%2FEjecta/lists"}