Move initialization of Accounts and Meteor.users into globals_*.js.

This commit is contained in:
Ben Newman
2015-04-17 19:04:42 -04:00
parent 7a6fcc92cd
commit b912ec8281
5 changed files with 34 additions and 30 deletions

View File

@@ -406,16 +406,3 @@ if (Package.blaze) {
return Meteor.loggingIn();
});
}
/**
* @namespace Accounts
* @summary The namespace for all client-side accounts-related methods.
*/
Accounts = new AccountsClient();
/**
* @summary A [Mongo.Collection](#collections) containing user documents.
* @locus Anywhere
* @type {Mongo.Collection}
*/
Meteor.users = Accounts._users;

View File

@@ -1460,20 +1460,3 @@ Ap._deleteSavedTokensForAllUsersOnStartup = function () {
});
});
};
/**
* @namespace Accounts
* @summary The namespace for all server-side accounts-related methods.
*/
Accounts = new AccountsServer();
// Users table. Don't use the normal autopublish, since we want to hide
// some fields. Code to autopublish this is in accounts_server.js.
// XXX Allow users to configure this collection name.
/**
* @summary A [Mongo.Collection](#collections) containing user documents.
* @locus Anywhere
* @type {Mongo.Collection}
*/
Meteor.users = Accounts._users;

View File

@@ -0,0 +1,12 @@
/**
* @namespace Accounts
* @summary The namespace for all client-side accounts-related methods.
*/
Accounts = new AccountsClient();
/**
* @summary A [Mongo.Collection](#collections) containing user documents.
* @locus Anywhere
* @type {Mongo.Collection}
*/
Meteor.users = Accounts.users;

View File

@@ -0,0 +1,16 @@
/**
* @namespace Accounts
* @summary The namespace for all server-side accounts-related methods.
*/
Accounts = new AccountsServer(Meteor.server);
// Users table. Don't use the normal autopublish, since we want to hide
// some fields. Code to autopublish this is in accounts_server.js.
// XXX Allow users to configure this collection name.
/**
* @summary A [Mongo.Collection](#collections) containing user documents.
* @locus Anywhere
* @type {Mongo.Collection}
*/
Meteor.users = Accounts.users;

View File

@@ -47,6 +47,12 @@ Package.onUse(function (api) {
api.addFiles('accounts_client.js', 'client');
api.addFiles('url_client.js', 'client');
api.addFiles('localstorage_token.js', 'client');
// These files instantiate the default Accounts instance on the server
// and the client, so they must be evaluated last to ensure that the
// prototypes have been fully populated.
api.addFiles('globals_server.js', 'server');
api.addFiles('globals_client.js', 'client');
});
Package.onTest(function (api) {