Add the ability to pass custom event handlers to Photostream
Closed this issue · 1 comments
What I have in mind is something like this:
- The user passes to
<Photostream />
something along the lines of an object with keys likeonClick
onLoad
onHover
and so on where the values are the event handling functions. - We pass the event handling functions to the Components (so, the
<img />
tag in componentPhoto
as far as I can think).
Not sure if we need to do any kind of security checking here for the functions, but so far it looks pretty simple,
I came across the little issue with Javascript scoping. When passing a function to the EventHandlers
prop, the scope of the function is wherever it was made, and the context of the developer is limited to that. This means that there is no "hover when x" or any image-specific actions.
This would be solved with #9 since you'd be able to assemble your own component that will have its own event handlers. However, I still want to have some way to easily add simple event handlers.
I am thinking maybe binding this
to them when on the Photo
stage and document that so that they know they have access to it, and therefore state and prop?