Files
meteor/packages/random/deprecated.js
David Glasser db51a3a14c Eliminate the "past" package.
This package was always included in apps, and even if it was possible to remove,
there wasn't a compelling story about when users would remove and replace
it. Plus, not all backwards-compatibility code could even live in it (eg, field
names of objects), so it was incomplete. It also introduced odd load order
constraints.

Instead, we introduce two conventions for backwards-compatibility code:

  - Special comments of the form "// XXX COMPAT WITH 0.6.4"
  - When feasible, put backwards-compatibility code in a file called
    "deprecated.js" in the relevant package.

This is documented at:
https://github.com/meteor/meteor/wiki/Meteor-Style-Guide#deprecated-code-and-backwards-compatibility

Additionally, removed some symbols that existed for backwards compatibility with
Meteor 0.4.0 (changes made 10 months ago): Meteor.is_client, Meteor.is_server,
and (in a method) this.is_simulation.
2013-07-25 18:54:42 -07:00

18 lines
496 B
JavaScript

// Before this package existed, we used to use this Meteor.uuid()
// implementing the RFC 4122 v4 UUID. It is no longer documented
// and will go away.
// XXX COMPAT WITH 0.5.6
Meteor.uuid = function () {
var HEX_DIGITS = "0123456789abcdef";
var s = [];
for (var i = 0; i < 36; i++) {
s[i] = Random.choice(HEX_DIGITS);
}
s[14] = "4";
s[19] = HEX_DIGITS.substr((parseInt(s[19],16) & 0x3) | 0x8, 1);
s[8] = s[13] = s[18] = s[23] = "-";
var uuid = s.join("");
return uuid;
};