Comments (6)
First; really appreciate your involvement and activeness in reporting issues and suggestions!
Second... hmm, I never considered ES6 readiness. However I don't like this particular solution since it relies on checking for each image type individually (getPNG, getJPG) and there are many more image types that are already supported and I really do not want to have to make sure that this class, the webpack configs, the generateAssetsClass all match the growing lists of supported types.
The way I did it the way I did is so that the loader doesn't care what extensions are available and what is supported, it just attempts to load anything and everything that is available in the asset class.
If you think of a different solution that doesn't involve a giant if else if statement in every loader, please let me know...
from phaser-ce-npm-webpack-typescript-starter-project.
well, you could also use
js Object.getOwnPropertyNames(Assets.Images[image])
alas it would return more things and so you would have to test for more methods to ignore for example in loadatlases.
in this case:
["length", "name", "prototype", "getName", "getPNG"]
that said, I get it and agree - it is less elegant but I thought I share as I really wanted to use the es6 collection classes for my project. So I had to change this ....
from phaser-ce-npm-webpack-typescript-starter-project.
It's definitely good to know and something to keep an eye on; I've never done ES6 explicitly and never needed to write ES6 compliant TS so I never would have come across this.
I'll leave this issue open as it is an issue for sure, just not a pressing one.
Thanks!
from phaser-ce-npm-webpack-typescript-starter-project.
Agree, one thing to consider is that the loop you use right now fails silently in es6 and you end up with a project that just doesn't' load any of the resources. This then will make the sound loading code end up sitting in an endless loop.
It took me quite a while to figure out that it is this code that failed - I was blaming Phaser at first!
Anyways, I mention it just in case others try to use es6.
from phaser-ce-npm-webpack-typescript-starter-project.
I've made a working change over here :
#33
for (let option of Object.getOwnPropertyNames(Assets.Images[image])) {
if (option !== 'getName' && option.includes('get')) {
from phaser-ce-npm-webpack-typescript-starter-project.
Merged in #33, so this should be good to go now. Thanks!
from phaser-ce-npm-webpack-typescript-starter-project.
Related Issues (20)
- uglify error: Unexpected token: name (ImagesBackgroundTemplate) HOT 1
- Hacktoberfest 2017! HOT 5
- Uglify not working: throw new _ValidationError2.default(ajv.errors, name);
- add asset-binaryFile Support HOT 1
- npm run server:dev fails HOT 3
- Classic Pong clone made easy with this project HOT 1
- Integrate PusherJS HOT 1
- Suggestion for tslint.json HOT 2
- Working with loaded JSON HOT 2
- npm install not installing dependencies HOT 4
- Thanks HOT 1
- Unable to use plugins HOT 3
- Write files HOT 8
- Uncaught TypeError: Cannot convert undefined or null to object when build:dist
- Auto-Resize Support? HOT 2
- Tilemaps support in assets loader HOT 2
- Better dependency versions HOT 1
- Security risk for webpack-dev-server HOT 1
- [REQUEST] I've made a game using your boilerplate HOT 1
- node-png is incompatible with node 12.x.x HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phaser-ce-npm-webpack-typescript-starter-project.