Commit 783bfb8a authored by Kjetil Thuen's avatar Kjetil Thuen

Improved debouncing.

parent 963051b0
{ {
"name": "jquery-listentryinfo", "name": "jquery-listentryinfo",
"version": "0.1.0", "version": "0.1.0",
"main": "src/jquery.listentryinfo.js", "main": "src/jquery.listentryinfo.js",
"private": "true", "private": "true",
"ignore": [ "ignore": [
"**/.*", "**/.*",
"node_modules", "node_modules",
"components" "components"
], ],
"dependencies": { "dependencies": {
"jquery": "2.0.x" "jquery": "2.0.x"
} }
} }
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"grunt-bump": "latest" "grunt-bump": "latest"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://prosjekt.nsd.uib.no/gitlab/kjetil/jquery-listentryinfo.git" "url": "https://prosjekt.nsd.uib.no/gitlab/kjetil/jquery-listentryinfo.git"
} }
} }
...@@ -71,6 +71,9 @@ ...@@ -71,6 +71,9 @@
settings.extendedInfoFunc(listElem.attr('id'), defaultPopulateRevealDivFunc); settings.extendedInfoFunc(listElem.attr('id'), defaultPopulateRevealDivFunc);
}, },
showExpandedInfoASAP = debounce(showExpandedInfo, 50, false),
showExpandedInfoLater = debounce(showExpandedInfo, 500, false),
setSelectedElement = function (element, asap) { setSelectedElement = function (element, asap) {
var listElem, var listElem,
...@@ -98,11 +101,13 @@ ...@@ -98,11 +101,13 @@
if (sessionStorage !== undefined && settings.rememberLastSelected) { if (sessionStorage !== undefined && settings.rememberLastSelected) {
sessionStorage[sessionStorageKey] = listElem.attr('id'); sessionStorage[sessionStorageKey] = listElem.attr('id');
} }
if (asap) { if (asap) {
debounce(showExpandedInfo, 50, false)(); showExpandedInfoASAP();
} else { } else {
debounce(showExpandedInfo, 500, false)(); showExpandedInfoLater();
} }
} else { } else {
$('#' + settings.itemInfoDivId).hide(); $('#' + settings.itemInfoDivId).hide();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment