{"comment":{"created_at":"2011-10-15T20:42:50Z","body":"### Comment by [creaven](https://github.com/creaven) on 19 Jul 2010  4:44:14 PM UTC\n\n>What happens if the slow loop code is placed into a setTimout() with a delay of zero or 1?\nit's imposible for @while, because code must be executed in one moment\n\nif remove setTimeout, it's too don't work. During loop browser freezed and don't change cursor seted before loop, test:\n\n\n//util.js\n(function() {\n\nvar count = 0;\n\nthis.Hourglass = function(delay) {\n\tthis.delay = delay || 1000;\n};\n\nHourglass.prototype = {\n\n\ton: function() {\n\t\tcount++;\n\t\tthis.start();\n\t},\n\n\toff: function() {\n\t\tcount--;\n\t\tif(!count){\n\t\t\tremoveClass(document.documentElement, 'hourglass');\n\t\t}\n\t},\n\n\tstart: function() {\n\t\taddClass(document.documentElement, 'hourglass');\n\t}\n\n};\n\n\nfunction addClass(element, className) {\n\tif(!hasClass(element, className)) element.className = element.className + ' ' + className;\n};\n\nfunction removeClass(element, className) {\n\telement.className = element.className.replace(new RegExp('(^|\\\\s)' + className + '(?:\\\\s|$)'), '$1');\n};\n\nfunction hasClass(element, className) {\n\treturn new RegExp('(^|\\\\s)' + className + '(?:\\\\s|$)').test(element.className);\n};\n\n\n})();\n\n\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\t<head>\n\t\t<title></title>\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></meta>\n\t\t<style type=\"text/css\">\n\t\t\t.hourglass, .hourglass *{\n\t\t\t\tcursor:wait !important;\n\t\t\t}\n\t\t</style>\n\t\t<script src=\"util.js\" type=\"text/javascript\"></script>\n\t\t<script type=\"text/javascript\">\n\t\t\tvar hourglass = new Hourglass(1500);//start delay 1500;\n\n\t\t\tvar Process = function(options) {\n\t\t\t\tthis.dur = options.dur || 1000;\n\t\t\t\tthis.onStart = options.onStart || function() {};\n\t\t\t\tthis.onFinish = options.onFinish || function() {};\n\t\t\t};\n\n\t\t\tProcess.prototype = {\n\n\t\t\t\tstart: function() {\n\t\t\t\t\tvar self = this;\n\t\t\t\t\tsetTimeout(function() {self.finish.apply(self);}, this.dur);\n\t\t\t\t\tthis.onStart();\n\t\t\t\t},\n\n\t\t\t\tfinish: function() {\n\t\t\t\t\tthis.onFinish();\n\t\t\t\t}\n\n\t\t\t};\n\n\t\t\tvar longProcess = new Process({\n\n\t\t\t\tdur: 9000,\n\n\t\t\t\tonStart: function(){\n\t\t\t\t\tdocument.title = 'start long process';\n\t\t\t\t\thourglass.on();\n\t\t\t\t\tfor(var i = 0; i < 30000; i++){\n\t\t\t\t\t\tvar moo = document.createElement('moo');\n\t\t\t\t\t\tdocument.body.appendChild(moo);\n\t\t\t\t\t\tdocument.body.removeChild(moo);\n\t\t\t\t\t}\n\t\t\t\t\tdocument.title = 'moo'\n\t\t\t\t},\n\n\t\t\t\tonFinish: function(){\n\t\t\t\t\tdocument.title = 'finish long process';\n\t\t\t\t\thourglass.off();\n\t\t\t\t}\n\n\t\t\t});\n\t\t\t\n\t\t\tfunction startLong() {\n\t\t\t\tlongProcess.start();\n\t\t\t}\n\t\t\t\n\t\t</script>\n\t</head>\n\t<body>\n\t\t<button onclick=\"startLong()\">start long process</button>\n\t</body>\n</html>","updated_at":"2011-10-15T20:42:50Z","url":"https://api.github.com/repos/backplane-import/backplanejs/issues/comments/2417549","id":2417549,"user":{"gravatar_id":"d9eef3a47b3d8a652e7a4cd1210337db","avatar_url":"https://secure.gravatar.com/avatar/d9eef3a47b3d8a652e7a4cd1210337db?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/backplane-import","id":1123459,"login":"backplane-import"}},"action":"created","issue":{"number":72,"created_at":"2011-10-15T20:42:35Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"### Imported from backplanejs Google Code [issue 72](http://code.google.com/p/backplanejs/issues/detail?id=72).\n\n<table>\n\t<tr>\n\t\t<th>Reporter</th>\n\t\t<td><a href=\"https://github.com/markbirbeck\">markbirbeck</a></td>\n\t</tr>\n\t<tr>\n\t\t<th>Date</th>\n\t\t<td>7 Jul 2010  4:01:41 PM UTC</td>\n\t</tr>\n</table>\nAt the moment the slowness of the XForms processor when running IE leaves users a bit confused as to when the form is usable.\n\nTo get around this we should display an hourglass cursor whenever any lengthy operations are taking place.\n\n(Note that this is a feature that could be used outside of the XForms module, so I'm marking this as being in the 'core'.)\n\n\n***\nTicket status set to **Accepted**\n\n\n**Priority**: Medium\n**Type**: Enhancement","comments":9,"title":"Show an hourglass cursor when lengthy processes are underway","updated_at":"2011-10-15T20:42:50Z","url":"https://api.github.com/repos/backplane-import/backplanejs/issues/72","id":1919186,"assignee":{"gravatar_id":"d9eef3a47b3d8a652e7a4cd1210337db","avatar_url":"https://secure.gravatar.com/avatar/d9eef3a47b3d8a652e7a4cd1210337db?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/backplane-import","id":1123459,"login":"backplane-import"},"milestone":null,"closed_at":null,"user":{"gravatar_id":"d9eef3a47b3d8a652e7a4cd1210337db","avatar_url":"https://secure.gravatar.com/avatar/d9eef3a47b3d8a652e7a4cd1210337db?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/backplane-import","id":1123459,"login":"backplane-import"},"html_url":"https://github.com/backplane-import/backplanejs/issues/72","labels":[{"name":"performance","url":"https://api.github.com/repos/backplane-import/backplanejs/labels/performance","color":"dddddd"},{"name":"priority-medium","url":"https://api.github.com/repos/backplane-import/backplanejs/labels/priority-medium","color":"02d7e1"},{"name":"type-enhancement","url":"https://api.github.com/repos/backplane-import/backplanejs/labels/type-enhancement","color":"444444"}],"state":"open"},"legacy":{"issue_id":1919186,"comment_id":2417549}}