O'Reilly logo

Liferay User Interface Development by Frank Yu, Xinsheng Chen, Jonas X. Yuan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Delayed task example

A delayed task delays the reaction to an event. In a use case where you enter some digits into an input box, the JavaScript code should wait for a while, confirming that you are done with the typing, and then start validating your input. This feature is useful when the delay is necessary and significant.

AUI().ready('aui-delayed-task', function(A) { var demoNode = A.get('#demo'); var FocusTask = new A.DelayedTask( function() { this.addClass('aui-demo-hover'); }, demoNode ); var BlurTask = new A.DelayedTask( function() { this.removeClass('aui-demo-hover', this.get('className')); }, demoNode ); demoNode.on('mouseover', function(event) { BlurTask.cancel(); FocusTask.delay(); }); demoNode.on('mouseout', function(event) { FocusTask.cancel(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required