add com..

This commit is contained in:
wlh
2015-01-07 22:49:23 +08:00
parent b690d5bdbf
commit e31afd76bb
14 changed files with 412 additions and 11 deletions
+16
View File
@@ -0,0 +1,16 @@
/**
* Inspired from the book of JavaScript Patterns, Stoyan Stefanov.
* You can add some special value in this guid, such as user's email or nickname or id.
* @module guid for JavaScript client
*/
(function(exports){
exports.guid = {
'create': function(){
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
}).toUpperCase();
}
};
})(window);