mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Rename Meteor.id() -> Random.id()
This commit is contained in:
@@ -684,7 +684,7 @@ Template.api.cursor_observe_changes = {
|
||||
|
||||
Template.api.id = {
|
||||
id: "meteor_id",
|
||||
name: "Meteor.id()",
|
||||
name: "Random.id()",
|
||||
locus: "Anywhere",
|
||||
descr: ["Return a unique identifier."],
|
||||
args: [ ]
|
||||
|
||||
@@ -151,7 +151,7 @@ var toc = [
|
||||
{instance: "cursor", name: "observeChanges", id: "observe_changes"}
|
||||
],
|
||||
{type: "spacer"},
|
||||
"Meteor.id",
|
||||
"Random.id", // XXX move this to the packages section
|
||||
{name: "Meteor.Collection.ObjectID", id: "collection_object_id"},
|
||||
{type: "spacer"},
|
||||
{name: "Selectors", style: "noncode"},
|
||||
|
||||
@@ -772,7 +772,7 @@ Meteor._LivedataSubscription = function (
|
||||
if (self._subscriptionId) {
|
||||
self._subscriptionHandle = 'N' + self._subscriptionId;
|
||||
} else {
|
||||
self._subscriptionHandle = 'U' + Meteor.id();
|
||||
self._subscriptionHandle = 'U' + Random.id();
|
||||
}
|
||||
|
||||
// has _deactivate been called?
|
||||
|
||||
@@ -244,7 +244,7 @@ if (Meteor.isServer) {
|
||||
// First add a random item, which should be cleaned up. We use ready/onReady
|
||||
// to make sure that the second test block is only called after the added is
|
||||
// processed, so that there's any chance of the coll.find().count() failing.
|
||||
sub.added(collName, Meteor.id(), {foo: 42});
|
||||
sub.added(collName, Random.id(), {foo: 42});
|
||||
sub.ready();
|
||||
|
||||
if (options.stopInHandler) {
|
||||
|
||||
@@ -436,7 +436,7 @@ if (Meteor.isClient) {
|
||||
// conn._subscriptions is empty.
|
||||
var conn = new Meteor._LivedataConnection('/',
|
||||
{reloadWithOutstanding: true});
|
||||
var collName = Meteor.id();
|
||||
var collName = Random.id();
|
||||
var coll = new Meteor.Collection(collName, {manager: conn});
|
||||
var errorFromRerun;
|
||||
var gotErrorFromStopper = false;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
var makeCollection = function () {
|
||||
if (Meteor.isServer)
|
||||
return new Meteor.Collection(Meteor.id());
|
||||
return new Meteor.Collection(Random.id());
|
||||
else
|
||||
return new Meteor.Collection(null);
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// XXX update these comments
|
||||
|
||||
// XXX dups packages/minimongo/uuid.js
|
||||
|
||||
// Meteor.random() -- known good PRNG, replaces Math.random()
|
||||
@@ -29,6 +31,8 @@
|
||||
// SOFTWARE.
|
||||
(function() {
|
||||
|
||||
Random = {};
|
||||
|
||||
var HEX_DIGITS = "0123456789abcdef";
|
||||
var UNMISTAKABLE_CHARS = "23456789ABCDEFGHJKLMNPQRSTWXYZabcdefghijkmnopqrstuvwxyz";
|
||||
|
||||
@@ -148,7 +152,7 @@ Meteor.uuid = function () {
|
||||
return uuid;
|
||||
};
|
||||
|
||||
Meteor.id = function() {
|
||||
Random.id = function() {
|
||||
var digits = [];
|
||||
var base = UNMISTAKABLE_CHARS.length;
|
||||
// Length of 17 preserves around 96 bits of entropy, which is the
|
||||
|
||||
Reference in New Issue
Block a user