Clears state, uri mappings and caches. Browser caches still apply.
the keys which should be cleared. Default clears everything.
Calls each of the listeners registered for a given event.
Return an array listing the events for which the emitter has registered listeners.
Returns the attributes for this ResourceManager
the name of the attribute. Only "uris"
is acceptable.
Loads an Image resource.
fileName of the image to be returned
handler that'll be called on success
handler that'll be called on error
Add a listener to another EventEmitter.
This provides an event subscription list facility. Allowing subclasses to listen to other emitters and remove all or some listeners with a single call to Model.stopListening, later.
the event emitter to listen to
the name of the event to listen to
the callback for the event handler
Return the number of listeners listening to a given event.
Return the listeners registered for a given event.
Add a listener for a given event.
Add a one-time listener for a given event.
Register a filename and a URI in the resource manager.
name of the file or map of filename: uri.
uri when string fileName is specified
Remove all listeners, or those of the specified event.
Remove the listeners of a given event.
Safely set an attribute(s).
If the attribute set succeeds, a change:[attribute name]
event is fired.
change:[attribute name]
event handler receives this
object, the new value
and options
as arguments.
Additionally a change
event is also fired when all changes succeed. The change
event receives this
object and the options
as arguments.
the name of the attribute or map of values
the new value of the attribute
this object is sent down to the event handlers, useful to things down to your
handler. if options.silent
is true then events are not fired.
Removes to one or more listeners that were set earlier with calls to Model.listenTo.
Use the arguments to filter subscriptions. eg: model.stopListening(em)
will remove all
listeners on emitter em
. model.stopListening(em, 'change')
will remove all listeners for
change
event on emitter em
.
the event emitter on which the listener was set
the event to be removed
the callback to be removed
Returns JSON representation of the resource manager
ResourceManager manages async loading and caching of resources.
ResourceManager Basically, it maintains a map of fileNames to URI for the resource. When a request for resource fileName is received, the uri is looked up and the file is either async loaded or served from cache. This also manages a ready state with callbacks that tells when one or more resources are being loaded and when all resources are ready.