Git Product home page Git Product logo

Comments (6)

rroylance avatar rroylance commented on May 18, 2024

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.

chessIthaca avatar chessIthaca commented on May 18, 2024

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.

rroylance avatar rroylance commented on May 18, 2024

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.

chessIthaca avatar chessIthaca commented on May 18, 2024

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.

MajinBui avatar MajinBui commented on May 18, 2024

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.

rroylance avatar rroylance commented on May 18, 2024

Merged in #33, so this should be good to go now. Thanks!

from phaser-ce-npm-webpack-typescript-starter-project.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.