Today I've published a small library that was previously part of flow
-- It didn't had too much dependencies so it made sense to make it public for more generic use than flow. Here it is: https://github.com/flow-stack/amber-dom-events As the readme in github says, you can install it in an Amber project with:
And configuring the devel.js and deploy.js You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Sebastian Sastre wrote: > Today I've published a small library that was previously part of /flow/ > / > / > It didn't had too much dependencies so it made sense to make it public > for more generic use than flow. > > Here it is: > > https://github.com/flow-stack/amber-dom-events I've looked. This has two problems: 1. I see it as wrong to add such generic method names like 'off' or 'trigger' to Object. At least prefix all method with 'dom'*. There are other possible event mechanisms, maybe more generic (EventEmitter), and you use the names for the jQuery wrapper. 2. Don't use '$' global. In all of the amber code, AFAICT, jQuery name is used. And one day, when packages could have their own dependencies defined, jQuery will be loaded by default without defining $ global, and if possible, even without defining the jQuery global, using AMD. So your package should get jQuery as require("jquery"), not using the global. I think the best solution for this is simply to have Obje ct >> asJQuery and use that. For _DOM_ it actually works now, as DOM objects are wrapped in JSObjectProxy and it has functioning asJQuery. * Also, the name is misleading - they are jQuery events, not DOM events (AFAICT, using plain object as model for DOM events is not possibles, it's just that jQuery allows to wrap anything). -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by sebastianconcept
Thanks Sebastian!
-- I have a tangential question - How does this relate to the Announcements package in the system? How do they compare, and should Announcements not be used for general purpose eventing? - Brian On Saturday, December 20, 2014 at 1:19:39 PM UTC-7, Sebastian Sastre wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
I like them better than Announcements because using events does not require to add an Announcer which has two major downers for me:
1. requiring to add an instVar for it 2. not being able to get them all the way up into the Object class With this library I’ve published you can make any object an observer/reactor
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by sebastianconcept
From 0.14.0, you don't even need this library: you can do direct `anyObject asJQuery on: #eventName bind: [ ... ]`, `anyObject asJQuery off: #eventName`, `anyObject asJQuery trigger: #eventName` and all other allowed jQuery event API.
sebastian <[hidden email]>napísal/a: I like them better than Announcements because using events does not require to add an Announcer which has two major downers for me: 1. requiring to add an instVar for it 2. not being able to get them all the way up into the Object class With this library I’ve published you can make any object an observer/reactor
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Good to have this included in 0.14.0
I created https://github.com/amber-smalltalk/amber-documentation/issues/43 so that the issue will be looked into later. On 1/12/15, Herby Vojčík <[hidden email]> wrote: > From 0.14.0, you don't even need this library: you can do direct `anyObject > asJQuery on: #eventName bind: [ ... ]`, `anyObject asJQuery off: > #eventName`, `anyObject asJQuery trigger: #eventName` and all other allowed > jQuery event API. > > sebastian <[hidden email]>napísal/a: > >>IlikethembetterthanAnnouncementsbecauseusingeventsdoesnotrequiretoaddanAnnouncerwhichhastwomajordownersforme:1.requiringtoaddaninstVarforit2.notbeingabletogetthemallthewayupintotheObjectclassWiththislibraryI’vepublishedyoucanmakeanyobjectanobserver/reactorOnJan11,2015,at10:33PM,[hidden email]:ThanksSebastian!Ihaveatangentialquestion-HowdoesthisrelatetotheAnnouncementspackageinthesystem?Howdotheycompare,andshouldAnnouncementsnotbeusedforgeneralpurposeeventing?-BrianOnSaturday,December20,2014at1:19:39PMUTC-7,SebastianSastrewrote:TodayI'vepublishedasmalllibrarythatwaspreviouslypartofflowItdidn'thadtoomuchdependenciessoitmadesensetomakeitpublicformoregenericusethanflow.Hereitis:https://github.com/flow-stack/amber-dom-eventsAsthereadmeingithubsays,youcaninstallitinanAmberprojectwith:bowerinstallamber-dom-events--saveAndconfiguringthedevel.jsanddeploy.js--YoureceivedthismessagebecauseyouaresubscribedtotheGoogleGroups"amber-lang"group.Tounsubscribefromthisgroupandstopreceivingemailsfromit,[hidden email],visithttps://groups.google.com/d/optout.--YoureceivedthismessagebecauseyouaresubscribedtotheGoogleGroupsamber-langgroup.Tounsubscribefromthisgroupandstopreceivingemailsfromit,[hidden email],visithttps://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "amber-lang" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [hidden email]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by sebastianconcept
A quick follow up on this:
-- After a talk with Herby, I've reminded that Pharo is the Smalltalk API of reference for Amber so I've released an update of the library 0.1.5 where it uses the exact same protocol as Pharo objects for triggering and unobserving events as you can see here: https://github.com/flow-stack/amber-dom-events/blob/master/src/DOMEvents.st On Saturday, December 20, 2014 at 6:19:39 PM UTC-2, Sebastian Sastre wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |