I'm creating a client-side dynamic blog engine. Now I need a event system to handle many actions from DOM elements and the engine. Such as the engine is loading a article,user is switching a theme...
And I don't want to use a library to do this.
So far I've done is using a list to store callbacks for a event.
But I want each callback works with different objects.Like the DOM event.
I may add an id-like property to each object, and store (id,callbacks) in a event.I feel it's not so good.When comes with dynamically generated object,it could be complex to deal with.
How to implement it as simple as DOM event (to use)?