I am very new to Ember JS, and I even have to admit that it is my very first framework I use.
Well. I am facing a design problem. I want to make an audio webapplication which will at all time need to be able to play audio, and therefore I want to make an AudioPlayer
singleton that will be available in the app's entire lifespan.
According to Ember's documentation on Dependency Injection I could just register a factory, which by default is registered as singleton, and I could access it by all time via:
applicationInstance.lookup('audio:player'); // For example
This seems like an idea, but I also need an interface for the audio player, with knobs like play, pause and stop; HTML that is. Is that possible? To make a "view" for the factory?
The second possibility I see is making an audio-player
component, but with the component I have to give up the singleton, and I really only want just one audioplayer on the site, which will also be the owner of the AudioContext
, which is only needed once per site.
So. What should I do? Should I go with the factory or with the model?
PS: I want to think that I need a controller, but I have read in the Ember JS guide that it is soon to be deprecated.
Aucun commentaire:
Enregistrer un commentaire