uniqueId.js 250 B

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