Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Commit

Permalink
remove trailing spaces
Browse files Browse the repository at this point in the history
Change-Id: Ib45532eaedf1c090d4b3cdaffe830bbf8a09677e
  • Loading branch information
changchang committed Nov 27, 2012
1 parent c7993e7 commit cb5b64f
Show file tree
Hide file tree
Showing 31 changed files with 249 additions and 257 deletions.
44 changes: 22 additions & 22 deletions lib/application.js
Expand Up @@ -53,7 +53,7 @@ Application.init = function(opts) {
* // cwd: /home/game/
* pomelo start
* // app.getBase() -> /home/game
*
*
* @return {String} application base path
*
* @memberOf Application
Expand Down Expand Up @@ -86,7 +86,7 @@ Application.setupEnv = function(args) {

/**
* Load server info from configure file.
*
*
* @api private
*/
Application.loadServers = function() {
Expand Down Expand Up @@ -127,7 +127,7 @@ Application.processArgs = function(args){

/**
* Load default components for application.
*
*
* @api private
*/
Application.loadDefaultComponents = function(){
Expand Down Expand Up @@ -173,7 +173,7 @@ Application.filter = function (filter) {
};

/**
* Add before filter.
* Add before filter.
*
* @param {Object|Function} bf before fileter, bf(msg, session, next)
*
Expand Down Expand Up @@ -259,15 +259,15 @@ Application.load = function(name, component, opts) {
* Set the route function for the specified server type.
*
* Examples:
*
*
* app.route('area', routeFunc);
*
* var routeFunc = function(session, msg, app, cb) {
* // all request to area would be route to the first area server
* var areas = app.getServersByType('area');
* cb(null, areas[0].id);
* };
*
*
* @param {String} serverType server type string
* @param {Function} routeFunc route function. routeFunc(session, msg, app, cb)
* @return {Object} current application instance for chain invoking
Expand Down Expand Up @@ -393,7 +393,7 @@ Application._optComponents = function(method, cb) {
};

/**
* Assign `setting` to `val`, or return `setting`'s value.
* Assign `setting` to `val`, or return `setting`'s value.
*
* Example:
*
Expand All @@ -409,7 +409,7 @@ Application._optComponents = function(method, cb) {
* @param {String} val the setting's value
* @param {Boolean} attach whether attach the settings to application
* @return {Server|Mixed} for chaining, or the setting value
*
*
* @memberOf Application
*/
Application.set = function (setting, val, attach) {
Expand All @@ -425,10 +425,10 @@ Application.set = function (setting, val, attach) {

/**
* Get property from setting
*
*
* @param {String} setting application setting
* @return {String} val
*
*
* @memberOf Application
*/
Application.get = function (setting) {
Expand All @@ -441,12 +441,12 @@ Application.get = function (setting) {
* @param {String} key environment key
* @param {String} val environment value
* @return {Server|Mixed} for chaining, or the setting value
*
*
* @memberOf Application
*/
Application.loadConfig = function (key, val) {
var env = this.get('env');
val = require(val);
val = require(val);
if (val[env]) {
val = val[env];
}
Expand Down Expand Up @@ -498,10 +498,10 @@ Application.disable = function (setting) {
};

/**
* Configure callback for the specified env and server type.
* Configure callback for the specified env and server type.
* When no env is specified that callback will
* be invoked for all environments and when no type is specified
* that callback will be invoked for all server types.
* be invoked for all environments and when no type is specified
* that callback will be invoked for all server types.
*
* Examples:
*
Expand All @@ -516,8 +516,8 @@ Application.disable = function (setting) {
* app.configure('development', 'connector', function(){
* // executed for development env and connector server type
* });
*
* @param {String} env application environment
*
* @param {String} env application environment
* @param {Function} fn callback function
* @param {String} type server type
* @return {Application} for chaining
Expand All @@ -526,7 +526,7 @@ Application.disable = function (setting) {
Application.configure = function (env, type, fn) {
var args = [].slice.call(arguments);
fn = args.pop();
env = 'all';
env = 'all';
type = 'all';

if(args.length > 0) {
Expand All @@ -546,7 +546,7 @@ Application.configure = function (env, type, fn) {

/**
* Get all the server infos.
*
*
* @return {Object} server info map, key: server id, value: server info
*
* @memberOf Application
Expand All @@ -557,7 +557,7 @@ Application.getServers = function() {

/**
* Get server info by server id.
*
*
* @param {String} serverId server id
* @return {Object} server info or undefined
*
Expand All @@ -569,7 +569,7 @@ Application.getServerById = function(serverId) {

/**
* Get server infos by server type.
*
*
* @param {String} serverType server type
* @return {Array} server info list
*
Expand Down Expand Up @@ -620,7 +620,7 @@ Application.isMaster = function() {

/**
* Register admin modules. Admin modules is the extends point of the monitor system.
*
*
* @param {String} module (optional) module id or provoided by module.moduleId
* @param {Object} module module object or factory function for module
* @param {Object} opts construct parameter for module
Expand Down
24 changes: 12 additions & 12 deletions lib/common/service/channelService.js
Expand Up @@ -12,9 +12,9 @@ var ST_INITED = 0;
var ST_DESTROYED = 1;

/**
* Create and maintain channels for server local.
* Create and maintain channels for server local.
*
* ChannelService is created by channel component which is a default loaded
* ChannelService is created by channel component which is a default loaded
* component of pomelo and channel service would be accessed by `app.get('channelService')`.
*
* @class
Expand Down Expand Up @@ -48,7 +48,7 @@ ChannelService.prototype.createChannel = function(name) {
*
* @param {String} name channel's name
* @param {Boolean} create if true, create channel
* @return {Channel}
* @return {Channel}
* @memberOf ChannelService
*/
ChannelService.prototype.getChannel = function(name, create) {
Expand All @@ -61,7 +61,7 @@ ChannelService.prototype.getChannel = function(name, create) {

/**
* Destroy channel by name.
*
*
* @param {String} name channel name
* @memberOf ChannelService
*/
Expand Down Expand Up @@ -93,11 +93,11 @@ ChannelService.prototype.pushMessageByUids = function(msg, uids, cb) {
};

/**
* Channel maintains the receiver collection for a subject. You can
* Channel maintains the receiver collection for a subject. You can
* add users into a channel and then broadcast message to them by channel.
*
* @class channel
* @constructor
* @constructor
*/
var Channel = function(name, service) {
this.name = name;
Expand Down Expand Up @@ -129,7 +129,7 @@ Channel.prototype.add = function(uid, sid) {
* Remove user from channel.
*
* @param {Number} uid user id
* @param {String} sid frontend server id which user has connected to.
* @param {String} sid frontend server id which user has connected to.
* @return [Boolean] true if success or false if fail
*/
Channel.prototype.leave = function(uid, sid) {
Expand All @@ -139,9 +139,9 @@ Channel.prototype.leave = function(uid, sid) {

/**
* Get channel members.
*
*
* <b>Notice:</b> Heavy operation.
*
*
* @return {Array} channel member uid list
*/
Channel.prototype.getMembers = function() {
Expand All @@ -162,7 +162,7 @@ Channel.prototype.getMembers = function() {

/**
* Get Member info.
*
*
* @param {String} uid user id
* @return {Object} member info
*/
Expand Down Expand Up @@ -222,7 +222,7 @@ var deleteFrom = function(uid, sid, group) {
if(!group) {
return true;
}

for(var i=0, l=group.length; i<l; i++) {
if(group[i] === uid) {
group.splice(i, 1);
Expand Down Expand Up @@ -281,4 +281,4 @@ var sendMessageByGroup = function(channelService, msg, groups, cb) {
latch.done();
});
}
};
};
4 changes: 2 additions & 2 deletions lib/common/service/handlerService.js
Expand Up @@ -5,7 +5,7 @@ var utils = require('../../util/utils');
/**
* Handler service.
* Dispatch request to the relactive handler.
*
*
* @param {Object} app current application context
* @param {Object} handlers handler map
*/
Expand Down Expand Up @@ -45,7 +45,7 @@ Service.prototype.handle = function(routeRecord, msg, session, cb){

/**
* Get handler instance by routeRecord.
*
*
* @param {Object} handlers handler map
* @param {Object} routeRecord route record parsed from route string
* @return {Object} handler instance if any matchs or null for match fail
Expand Down
38 changes: 19 additions & 19 deletions lib/common/service/localSessionService.js
Expand Up @@ -8,7 +8,7 @@ var utils = require('../../util/utils');
var EXPORT_INCLUDE_FIELDS = ['id', 'frontendId', 'uid', 'settings'];

/**
* Service the maintain local sessions and the communiation
* Service the maintain local sessions and the communiation
* with frontend server.
*/
var LocalSessionService = function(app) {
Expand Down Expand Up @@ -53,17 +53,17 @@ var rpcInvoke = function(app, sid, namespace, service, method, args, cb) {
};

/**
* LocalSession is the proxy for global session passed to handlers and it helps to keep
* the key/value pairs for the server local. Global session locates in frontend server
* and should not be accessed directly.
*
* The mainly operation on local session should be read and any changes happen in local
* session is local and would be discarded in next request. You have to push the
* changes to the frontend manually if necessary. Any push would overwrite the last push
* of the same key silently and the changes would be saw in next request.
* And you have to make sure the transaction outside if you would push the session
* concurrently in different processes.
*
* LocalSession is the proxy for global session passed to handlers and it helps to keep
* the key/value pairs for the server local. Global session locates in frontend server
* and should not be accessed directly.
*
* The mainly operation on local session should be read and any changes happen in local
* session is local and would be discarded in next request. You have to push the
* changes to the frontend manually if necessary. Any push would overwrite the last push
* of the same key silently and the changes would be saw in next request.
* And you have to make sure the transaction outside if you would push the session
* concurrently in different processes.
*
* See the api below for more details.
*
* @class
Expand All @@ -80,9 +80,9 @@ var LocalSession = function(opts, service) {
util.inherits(LocalSession, EventEmitter);

/**
* Bind current session with the user id. It would push the uid to frontend
* Bind current session with the user id. It would push the uid to frontend
* server and bind uid to the global session.
*
*
* @param {Number|String} uid user id
* @param {Function} cb callback function
*
Expand All @@ -100,7 +100,7 @@ LocalSession.prototype.bind = function(uid, cb) {

/**
* Set the key/value into local session.
*
*
* @param {String} key key
* @param {Object} value value
*/
Expand All @@ -110,7 +110,7 @@ LocalSession.prototype.set = function(key, value) {

/**
* Get the value from local session by key.
*
*
* @param {String} key key
* @return {Object} value
*/
Expand All @@ -120,7 +120,7 @@ LocalSession.prototype.get = function(key) {

/**
* Push the key/value in local session to the global session.
*
*
* @param {String} key key
* @param {Function} cb callback function
*/
Expand All @@ -130,7 +130,7 @@ LocalSession.prototype.push = function(key, cb) {

/**
* Push all the key/values in local session to the global session.
*
*
* @param {Function} cb callback function
*/
LocalSession.prototype.pushAll = function(cb) {
Expand All @@ -139,7 +139,7 @@ LocalSession.prototype.pushAll = function(cb) {

/**
* Export the key/values for serialization.
*
*
* @api private
*/
LocalSession.prototype.export = function() {
Expand Down

0 comments on commit cb5b64f

Please sign in to comment.