uniqueId.js 283 B

12345678910111213
  1. define(function () {
  2. // Generate a unique integer id (unique within the entire client session).
  3. // Useful for temporary DOM ids.
  4. var idCounter = 0;
  5. function uniqueId(prefix) {
  6. var id = ++idCounter + '';
  7. return prefix ? prefix + id : id;
  8. }
  9. return uniqueId;
  10. });