Login   Register  
Icontem

File: examples_and_documents/js/sampleModuleError.js

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tomas Corral  >  Hydra.js  >  examples_and_documents/js/sampleModuleError.js  >  Download  
File: examples_and_documents/js/sampleModuleError.js
Role: Example script
Content type: text/plain
Description: Example simple module with error
Class: Hydra.js
Modular event action handler
Author: By
Last change:
Date: 2011-07-21 13:16
Size: 543 bytes
 

Contents

Class file image Download
Hydra.module.register("sampleError", function(oAction)
{
	return {
		sModule: 'NeverArrivesHere',
		init: function(oData)
		{
			alert("ModuleWithError");
			oAction.listen(["alert"], this.handleAction, this);
			
			throw new Error("Ha habido un error");
			
			oAction.notify({
				type: 'alert',
				data: ++nIndex
			});
		},
		handleAction: function(oAction)
		{
			switch(oAction.type)
			{
				case "alert": 
					alert(oAction.data);
					break;
				default: break;
			}
		},
		destroy: function(){}
	};
});