Closed RblSb closed 11 months ago
I'm sorry but... I don't know what you are talking about.
This PR solves two problems:
Assets.loadEverything(() -> {}, (err:AssetError) -> {
throw err;
});
Will be detected as (callback, null, null, failed)
, instead of (callback, filter)
, since callbacks are not Dynamic anymore.
And it also solves problem, when you try to access item.name
fields, like:
Assets.loadEverything(() -> {}, item -> {
return item.name.contains("menu");
});
Since item.name
will be typed as String
, and not Dynamic
with unknown native contains
method (for example, js has str.includes
, but no str.contains
)
OK. But I originally made those dynamic because I wanted to add the option to add any data to assets in the khafile. Can typedefs support that?
There is no typedef A = {foo:Int} & Dynamic;
support in haxe yet, but if you think about making this feature before that support, i can change this typedef to abstract
, that will provide completion for item.name
/ other fields with good types, but also allow item.anythingElse
fields and return Dynamic values from them.
Yes, let's make some abstract art.
I spended enough hours today debugging why this (not my) silly code breaks on cpp:
I want to improve this api, which will also fix future dynamic problems, like
dynamicObj.name.contains
failure on some static targets. With typed callbacks this should be harder to break and easier to use now. Also, is this possible to get shaders in assets loader? Seems like not, or there is some ways to enable runtime loading?