File: examples_and_documents/js/sampleModuleListener.js

Recommend this page to a friend!
  Classes of Tomas Corral   Hydra.js   ???   Download  
File: examples_and_documents/js/???
Role: Example script
Content type: text/plain
Description: Example module implement listener
Class: Hydra.js
Modular event action handler
Author: By
Last change:
Date: 13 years ago
Size: 754 bytes
 

Contents

Class file image Download
Hydra.module.register("sampleModuleListener", function (action) { return { sModule: 'BaseSample', init: function (oData) { alert("Listener Module started"); this.createLinkAndAddEvent(); action.listen(['linkClicked'], this.handleAction, this); }, createLinkAndAddEvent: function() { var oLink = document.createElement("a"); oLink.href = '#'; oLink.innerHTML = 'Start Notifier Module'; $(oLink).click(function () { Hydra.module.start('sampleModuleNotifier'); }); document.body.appendChild(oLink); }, handleAction: function (oNotifier) { if(oNotifier.type !== 'linkClicked') { return; } alert('Link clicked Listener'); }, destroy: function () {} }; });