devgeeks / Canvas2ImagePlugin

PhoneGap / Cordova plugin for iOS to save the contents of an HTML canvas to the device's Photo Library
211 stars 218 forks source link

Pass element instead of id to the plugin? #3

Closed bebraw closed 11 years ago

bebraw commented 12 years ago

Hi,

Would you mind changing the plugin signature to something like this?

function(successCallback, failureCallback, canvas)

This would work better with my codebase. I don't mind hacking this locally. Just thought this might be a good idea generally. :)

devgeeks commented 12 years ago

Do you mean passing in an element instead of an id?

bebraw commented 12 years ago

Yeah. I think something like this would be pretty ideal: https://gist.github.com/3046527 . I added AMD support there and dropped the PhoneGap related bits (legacy?) since I'm happy with Cordova. Might want to do something along this.

devgeeks commented 12 years ago

Sounds like you have it sorted. ;)

I still use PhoneGap so I still support it in my plugins. If you are happy with your fork it sounds like the way to go.

I am not sure what the benefit of feeding an element vs an id is?

bebraw commented 12 years ago

I am not sure what the benefit of feeding an element vs an id is?

Well. If you happen to have a reference to an element directly, it's more way easier just to pass that than go through id. In other words this interface supports more use cases. Besides it's easy for someone using a lot of ids to wrap it in a func later on. Difficult the other way around.

devgeeks commented 12 years ago

Still planning on looking into this...

devgeeks commented 11 years ago

Latest version should support this.