_.uniqueId is unique per page load, switch back to hex style unique id
This commit is contained in:
parent
1352a1b827
commit
0994cb003a
1 changed files with 7 additions and 3 deletions
|
@ -9,9 +9,13 @@ var util = (function() {
|
|||
// milliseconds. Tries to minimize latency.
|
||||
return _.debounce(f, period)
|
||||
},
|
||||
// Unique IDs
|
||||
uniqueId: _.uniqueId
|
||||
}
|
||||
uniqueId: function(length) {
|
||||
// Unique-ish IDs as a length sized string of hex
|
||||
var id = '', hex = '0123456789abcdef';
|
||||
_(length || 40).times(function() { id += hex[_.random(15)]; });
|
||||
return id;
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
$(function() {
|
||||
|
|
Loading…
Reference in a new issue