Last active
April 15, 2016 04:44
-
-
Save patorash/1ac15f28f84cd22639f681df0e97ba2f to your computer and use it in GitHub Desktop.
knockout.jsでカーソルを砂時計に変えるbindingHandlerをを作った。Ajaxなど待ち時間が発生する際にお使いください。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ko.bindingHandlers.cursor_wait = { | |
init: function(element, valueAccessor) { | |
ko.computed({ | |
read: function() { | |
if (ko.unwrap(valueAccessor())) | |
document.body.style.cursor = 'wait'; | |
else | |
document.body.style.cursor = 'auto'; | |
}, | |
disposeWhenNodeIsRemoved: element | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment