Evented Javascript

  • 462 views
Uploaded on

Using events in various javascript environments.

Using events in various javascript environments.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
462
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
4
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Evented Javascript
  • 2. Refresher
    DOM Event Model
    addEventListener& attachEvent
    jQuery Bind
    $.bind(‘click’, function(){…})
    jQuery Shortcuts
    $.click(function(){…})
    jQuery Live & Delegate
    $.live(‘click’, func…), $.delegate(‘#foo’, ‘click’, func…)
  • 3. More Bind
    Custom Events
    $.bind(‘closeDialog’, func…)
    Namespaced Events
    $.bind(‘click.linkDialog’, func…)
    $.bind(‘closeDialog.linkDialog’, func…)
    Bind to Non-DOM Objects
    $(confluence.linkDialog).bind(‘closeDialog’, func…)
    $(confluence.linkDialog).trigger(‘closeDialog’)
  • 4. $.bind as an event model
    Provides starting place
    More elaborate event models exist
    More power affords flexibility but lends itself to poor execution of an event driven design
  • 5. Other Event Models
    CKEditor
    node.js
  • 6. Back to The DOM and jQuery
    Dialog, escape closes dialog
    Autocomplete, escape closes suggestions
    stopPropagation becomes necessary
    Return false is actually evil
    Assumptions made
  • 7. Binding to Native Events
    Bind almost no logic to native events
  • 8. Sources
    TinyMCE.com
    CKEditor.com
    nodejs.org
    YUI Blog - http://www.yuiblog.com/blog/2007/01/17/event-plan/
    Event Driven Javascript - http://www.slideshare.net/fgalassi/event-driven-javascript