Class Index | File Index

Classes


Function Namespace Pot.Signal.attachAfter


Defined in: <pot.js>.

Function Namespace Summary
Constructor Attributes Constructor Name and Description
 
Pot.Signal.attachAfter(object, signalName, callback, (useCapture), (once))
Attaches a signal to a slot on after, and return a handler object as a unique identifier that can be used to detach that signal.
Method Summary
Method Attributes Method Name and Description
<static>  
Pot.Signal.attachAfter.once(object, signalName, callback, (useCapture))
Similar to attach*(), but detaches the signal handler automatically once it has fired.
Function Namespace Detail
Pot.Signal.attachAfter(object, signalName, callback, (useCapture), (once))
Attaches a signal to a slot on after, and return a handler object as a unique identifier that can be used to detach that signal.
  // Set the event of pressing the Save button.
  attach('#saveData', 'click', function() {
    // Saving function.
    saveData(document.getElementById('inputText').value);
    // Function to send a message to user that the data saved.
    showSaveData('Saved!');
  });
  // Add the callback function for
  //  move the focus after click the element.
  attachAfter('#saveData', 'click', function() {
    document.getElementById('inputText').focus();
  });
  // To configure the logging before calling it.
  attachBefore('#saveData', 'click', function() {
    MyLogger.log('Save inputText');
  });
Parameters:
{Object|Function|String} object
The object that be target of the signal. If passed in a string then will be a HTML element by document.getElementById.
{String|Array} signalName
`signalName` is a string that represents a signal name. If `object` is a DOM object then it can be specify one of the 'onxxx' native events. That case 'on' prefix is optionally.
{Function} callback
An action to take when the signal is triggered.
{Boolean} (useCapture)
(Optional) `useCapture` will passed its 3rd argument to addEventListener if environment is available it on DOM.
{Boolean} (once)
(Optional) Only internal usage.
Returns:
{Object|Array} Return an instance of Pot.Signal.Handler object as a unique identifier that can be used to detach that signal.
Method Detail
<static> {Function} Pot.Signal.attachAfter.once(object, signalName, callback, (useCapture))
Similar to attach*(), but detaches the signal handler automatically once it has fired.
  attachAfter.once(document.body, 'click', function() {
    alert('This message will show only once.');
  });
Parameters:
{Object|Function|String} object
The object that be target of the signal. If passed in a string then will be a HTML element by document.getElementById.
{String} signalName
`signalName` is a string that represents a signal name. If `object` is a DOM object then it can be specify one of the 'onxxx' native events. That case 'on' prefix is optionally.
{Function} callback
An action to take when the signal is triggered.
{Boolean} (useCapture)
(Optional) `useCapture` will passed its 3rd argument to addEventListener if environment is available it on DOM.
Returns:
{Object} Return an instance of Pot.Signal.Handler object as a unique identifier that can be used to detach that signal.

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Sep 21 2012 19:32:22 GMT+0900 (JST)