whatwg / loader

Loader Standard
https://whatwg.github.io/loader/
Creative Commons Zero v1.0 Universal
607 stars 45 forks source link

Iterating over the registry #17

Closed matthewp closed 9 years ago

matthewp commented 9 years ago

In this comment @dherman you mentioned that to share registries between loaders you could simply copy over the entries. I agree that this is a good natural way to share. However to do that you would need to be able to iterate over the entries. What do you think about having the Loader implement @@iterator so that this can be done?

dherman commented 9 years ago

Yes we will need a way to iterate. It's on my todo list. I'll leave this issue open till it's specified. Thanks!

EisenbergEffect commented 9 years ago

:+1:

caridy commented 9 years ago

Solved by https://github.com/whatwg/loader/pull/65.

for (let entry of System.loader.registry) {
    ...
})
EisenbergEffect commented 9 years ago

Excellent. Your work is appreciated :smile:

matthewp commented 9 years ago

Thanks @caridy !

caridy commented 9 years ago

https://whatwg.github.io/loader/#registry-prototype-@@iterator, while GetRegistryEntry defines what will be accesible thru the iteration.

Note: since registry is not an iterator, it implements @@iterator, you might get into racing conditions.