PIXI.js Back-End "shim". For mocking Canvas in Node.js with ??????
-
Designed for node - it makes you run universal javascript code that is designed with pixi.js on node.js environment
-
It is very lazy - meaning it won't load anything twice and won't attempt to load it if it's not required
-
It wont even load itself twice - while including multiple instances of pixi.js can cause
Cannot redefine property isJson
Error
with lazy polyfill of
- DOM
- Window
- Canvas
- PIXI
- other polyfills (requestAnimationFrame, etc.)
require("pixi-shim");
and it still doesn't work, you might need to
$ yarn add pixi.js-legacy
and then do
require("pixi-shim");
require("pixi.js-legacy");
$ yarn add pixi-shim
environment flag DEBUG enables DEBUG with progress on which polyfill have been loaded
$ DEBUG=pixi-shim node -r pixi-shim yourscript.js
a bit hackish but works, see:
- https://github.com/Prozi/pixi-shim/blob/master/pixi.spec.js
- https://github.com/Prozi/pixi-shim/blob/master/to-data-url.js
Total test suites: 2
Passed test suites: 2
Done in 4.35s.
ites: 0
Total tests: 10
Passed tests: 10
Failed tests: 0
Test Suite - /home/pietal/projects/pixi-shim/index.spec.js
passed - GIVEN pixi-shim THEN requiring it doesnt throw error
passed - GIVEN pixi-shim THEN new PIXI.Application doesnt throw error
passed - GIVEN pixi-shim THEN new PIXI.Sprite from base64 image does *not* work
passed - GIVEN pixi-shim THEN toDataURL does *not* yet work
passed - GIVEN pixi-shim THEN normal PIXI gameLoop works
Test Suite - /home/pietal/projects/pixi-shim/pixi.spec.js
passed - GIVEN pixi-shim/pixi THEN requiring it doesnt throw error
passed - GIVEN pixi-shim/pixi THEN new PIXI.Application doesnt throw error
passed - GIVEN pixi-shim/pixi THEN new PIXI.Sprite from base64 image *should* work
passed - GIVEN pixi-shim/pixi THEN toDataURL *should* work with pixi.js
passed - GIVEN pixi-shim/pixi THEN normal PIXI gameLoop works
https://app.circleci.com/pipelines/github/Prozi/pixi-shim
MIT