Skip to content

Instantly share code, notes, and snippets.

@dmnsgn
Created June 20, 2020 17:04
Show Gist options
  • Save dmnsgn/753f97ed4a7cebd2bae8c3bcce88473d to your computer and use it in GitHub Desktop.
Save dmnsgn/753f97ed4a7cebd2bae8c3bcce88473d to your computer and use it in GitHub Desktop.
// Author: Abhishek Dutta, 12 June 2020
// License: CC0 (https://creativecommons.org/choose/zero/)
export default function uuid() {
var temp_url = URL.createObjectURL(new Blob());
var uuid = temp_url.toString();
URL.revokeObjectURL(temp_url);
return uuid.substr(uuid.lastIndexOf('/') + 1); // remove prefix (e.g. blob:null/, blob:www.test.com/, ...)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment