blob: 31175a4af779c07ac932102a2a3cf16f91864dc9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* <copyright>
This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
</copyright> */
/* <notice>
Code from node-uuid: https://github.com/broofa/node-uuid/raw/master/uuid.js<br/>
MIT license https://github.com/broofa/node-uuid/blob/master/LICENSE.md<br/>
</notice> */
/**
@module components/core/class-uuid
@requires montage/core/core
*/
/**
@class components/core/class-uuid.ClassUuid
@extends module:montage/core/core.Montage
*/
var Montage = require("montage/core/core").Montage,
CHARS = '0123456789ABCDEF'.split(''),
FORMAT = 'xxxxx'.split(''),
ClassUuid = exports.ClassUuid = Montage.create(Montage,/** @lends module:montage/core/class-uuid.ClassUuid# */ {
/**
Returns a univerally unique ID (UUID).
@function
@param {Property} argument TODO
@returns {String} The UUID.
*/
generate: {
enumerable: false,
value: function generate(argument) {
var c = CHARS, id = FORMAT, r;
id[0] = c[(r = Math.random() * 0x100000000) & 0xf];
id[1] = c[(r >>>= 4) & 0xf];
id[2] = c[(r >>>= 4) & 0xf];
id[3] = c[(r >>>= 4) & 0xf];
id[4] = c[(r >>>= 4) & 0xf];
return id.join('');
}
}
});
|