uniqueId.js 283 B

1234567891011121314
  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. });