ecsyjs / ecsy

Entity Component System for javascript
https://ecsyjs.github.io/ecsy/
MIT License
1.11k stars 115 forks source link

Is there any way to inject service in System or World? #265

Open rkdrnf opened 4 years ago

rkdrnf commented 4 years ago

Sometimes a system needs to access other services to do the business logic inside execute(). For example, generating auto-incrementing id of a specific component when adding the component in multiple systems. Is there any way to inject any service into System or World?

rkdrnf commented 4 years ago

Right after writing this issue I just found that there's attributes parameter in registerSystem and it is passed to init of the system.

It would be better if it has explicit documentation of how to use it.