From 2dc8fd19aa92865f4e8ded54b0664c4a2eaf21c4 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 30 Jun 2012 12:29:06 +0200 Subject: [PATCH] update docs --- source/Ox.UI/js/Core/Element.js | 47 ++++++++++++++++++++------------- source/Ox.UI/js/Core/Event.js | 38 +++++++++++++------------- 2 files changed, 47 insertions(+), 38 deletions(-) diff --git a/source/Ox.UI/js/Core/Element.js b/source/Ox.UI/js/Core/Element.js index c2bc5e78..cb0d4387 100644 --- a/source/Ox.UI/js/Core/Element.js +++ b/source/Ox.UI/js/Core/Element.js @@ -247,10 +247,13 @@ Ox.Element = function(options, self) { } /*@ - bindEvent Binds a function to an event - (callback) -> This element - (event, callback) -> This element + bindEvent Adds event handler(s) + (callback) -> This element + Adds a catch-all handler + (event, callback) -> This element + Adds a handler for a single event ({event: callback, ...}) -> This element + Adds handlers for multiple events callback Callback function data event data (key/value pairs) event Event name @@ -262,9 +265,13 @@ Ox.Element = function(options, self) { }; /*@ - bindEventOnce Binds a function to an event, once - (event, callback) -> This element object - ({event: callback, ...}) -> This element object + bindEventOnce Adds event handler(s) that run(s) only once + (callback) -> This element + Adds a catch-all handler + (event, callback) -> This element + Adds a handler for a single event + ({event: callback, ...}) -> This element + Adds handlers for multiple events callback Callback function data event data (key/value pairs) event Event name @@ -392,10 +399,13 @@ Ox.Element = function(options, self) { }; /*@ - triggerEvent Triggers an event - (event) -> This element object - (event, data) -> This element object - ({event: data, ...}) -> This element object + triggerEvent Triggers one or more events + (event) -> This element object + Triggers an event + (event, data) -> This element object + Triggers an event with data + ({event: data, ...}) -> This element object + Triggers multiple events with data event Event name data Event data (key/value pairs) @*/ @@ -405,19 +415,18 @@ Ox.Element = function(options, self) { }; /*@ - unbindEvent Unbinds all callbacks from an event - To unbind a specific handler, use namespaced events, like - `bindEvent('click.foo', callback)`, and then `unbindEvent('click.foo')`. - () -> This element - Unbinds all callbacks from all events + unbindEvent Removes event handler(s) + () -> This element + Removes all handlers. (callback) -> This element - Unbinds one callback from all events + Removes a specific catch-all handler (event) -> This element - Unbinds all callbacks from one event + Removes all handlers for a single event (to remove all catch-all + handlers, pass '*' as event) (event, callback) -> This element - Unbinds one callback from one event + Removes a specific handler for a single event ({event: callback}, ...) -> This element - Unbinds multiple callbacks from multiple events + Removes specific handlers for multiple events event Event name @*/ that.unbindEvent = function() { diff --git a/source/Ox.UI/js/Core/Event.js b/source/Ox.UI/js/Core/Event.js index 5dd277d0..245d11ca 100644 --- a/source/Ox.UI/js/Core/Event.js +++ b/source/Ox.UI/js/Core/Event.js @@ -40,15 +40,15 @@ Ox.Event = (function() { } /*@ - .bind Adds an event handler + .bind Adds event handler(s) (callback) -> Ox.Event - Add a global event handler + Adds a global event handler (self, callback) -> Ox.Event - Add a catch-all event handler + Adds a catch-all handler (self, event, callback) -> Ox.Event - Add an event handler for a single event + Adds a handler for a single event (self, {event: callback, ...}) -> Ox.Event - Add event handlers for multiple events + Adds handlers for multiple events self The element's shared private object callback Callback function data Event data @@ -78,13 +78,13 @@ Ox.Event = (function() { }; /*@ - .bindOnce Adds an event handler that fires once + .bindOnce Adds event handler(s) that run(s) only once (self, callback) -> Ox.Event - Add a catch-all event handler + Adds a catch-all handler (self, event, callback) -> Ox.Event - Add an event handler for a single event + Adds an event handler for a single event (self, {event: callback, ...}) -> Ox.Event - Add event handlers for multiple events + Adds event handlers for multiple events self The element's shared private object callback Callback function data Event data @@ -110,11 +110,11 @@ Ox.Event = (function() { /*@ .trigger Triggers an event (self, event) -> Ox.Event - Trigger an event + Triggers an event (self, event, data) -> Ox.Event - Trigger an event with event data + Triggers an event with data (self, {event: data, ...}) -> Ox.Event - Trigger multiple events with event data + Triggers multiple events with data self The element's shared private object event Event name data Event data @@ -144,19 +144,19 @@ Ox.Event = (function() { /*@ .unbind Removes an event handler () -> Ox.Event - Remove all global event handlers + Removes all global handlers (callback) -> Ox.Event - Remove a global event handler + Removes a global handler (self) -> Ox.Event - Remove all event handlers + Removes all handlers (self, callback) -> Ox.Event - Unbind a specific catch-all event handler + Removes a specific catch-all handler (self, event) -> Ox.Event - Unbind all event handlers for a single event + Remove all handlers for a single event (self, event, callback) -> Ox.Event - Unbind a specific event handler for a single event + Removes a specific handler for a single event (self, {event: callback, ...}) -> Ox.Event - Unbind specific event handlers for multiple events + Removes specific event handlers for multiple events self The element's shared private object callback Callback function event Event name