Sternmiracle Posted April 30, 2020 Share Posted April 30, 2020 Hello! I am trying to set up a callback that fires whenever an asset starts loading in pixi v5. I did something like this: loader.add(myKey,....) loader.resources[myKey].onStart.add(...) The problem is that onStart (or any other signals for that matter) are not defined for the LoaderResource class. According to the docs, these exist, but I can't seem to get them. LoaderResource has all other properties like url, data, texture and such, just no signals. Am I missing something? The relevant packages I installed through npm are: pixi-js, pixi-sound, pixi-spine Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 30, 2020 Share Posted April 30, 2020 Hello and Welcome to the forums! Do you use typescript or do you get undefined type error in js? Yes, they might be not defined because we have a bit of a problem to make correct typings considering that resource-loader is separated from pixi: https://github.com/englercj/resource-loader We dont have time to fix it in current version because soon we are working on completely new typings that are not generated from jsdoc. We will also need to persuade resource-loader author to make changes to typings to make it better connect to pixi. Quote Link to comment Share on other sites More sharing options...
Sternmiracle Posted April 30, 2020 Author Share Posted April 30, 2020 Hello, and thanks for the welcoming message Yes, I am using typescript. That is unfortunate. Thanks for the info! Quote Link to comment Share on other sites More sharing options...
Exca Posted May 4, 2020 Share Posted May 4, 2020 While waiting for solution you could skip the warning by casting the resources to dynamic type (loader.resources[mykey] as any).onStart.add. You would lose autocompletion and other type security in that case though for those lines. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.