Permalink
Browse files

Use exports instead of this as exports is the official way according …

…to the commonjs spec
  • Loading branch information...
1 parent 9a306fd commit 5e255ccdf92d6760fb3b6531ee08e131dfba54fb @christiaan christiaan committed May 28, 2010
View
@@ -1,6 +1,6 @@
var options = require('./util/options').options;
-this.Client = Class({
+exports.Client = Class({
include: [options],
@@ -4,7 +4,7 @@ var url = require('url'),
Client = require('./client').Client,
transports = {};
-var Listener = this.Listener = Class({
+var Listener = exports.Listener = Class({
include: [process.EventEmitter.prototype, options],
@@ -2,9 +2,9 @@ var websocket = require('./websocket').websocket,
net = require('net'),
listeners = [];
-this.flashsocket = websocket.extend({});
-this.flashsocket.httpUpgrade = true;
-this.flashsocket.init = function(listener){
+exports.flashsocket = websocket.extend({});
+exports.flashsocket.httpUpgrade = true;
+exports.flashsocket.init = function(listener){
listeners.push(listener);
};
@@ -22,4 +22,4 @@ net.createServer(function(socket){
socket.write('</cross-domain-policy>\n');
socket.end();
-}).listen(843);
+}).listen(843);
@@ -1,7 +1,7 @@
var Client = require('../client').Client,
qs = require('querystring');
-this['htmlfile'] = Client.extend({
+exports.htmlfile = Client.extend({
_onConnect: function(req, res){
var self = this, body = '';
@@ -1,7 +1,7 @@
var Client = require('../client').Client,
url = require('url');
-this.websocket = Client.extend({
+exports.websocket = Client.extend({
_onConnect: function(req, socket){
var self = this;
@@ -66,4 +66,4 @@ this.websocket = Client.extend({
});
-this.websocket.httpUpgrade = true;
+exports.websocket.httpUpgrade = true;
@@ -1,7 +1,7 @@
var Client = require('../client').Client,
qs = require('querystring');
-this['xhr-multipart'] = Client.extend({
+exports['xhr-multipart'] = Client.extend({
_onConnect: function(req, res){
var self = this, body = '';
@@ -2,7 +2,7 @@ var Client = require('../client').Client,
qs = require('querystring'),
sys = require('sys');
-this['xhr-polling'] = Client.extend({
+exports['xhr-polling'] = Client.extend({
options: {
closeTimeout: 5000,
@@ -1,7 +1,7 @@
// Based on Mixin.js from MooTools (MIT)
// Copyright (c) 2006-2009 Valerio Proietti, <http://mad4milk.net/>
-this.flatten = function(arr){
+exports.flatten = function(arr){
var array = [];
for (var i = 0, l = arr.length; i < l; i++){
var item = arr[i];
@@ -10,7 +10,7 @@ this.flatten = function(arr){
return array;
};
-this.include = function(arr, item){
+exports.include = function(arr, item){
if (arr.indexOf(item) == -1) arr.push(item);
return arr;
};
@@ -1,7 +1,7 @@
// Based on Mixin.js from MooTools (MIT)
// Copyright (c) 2006-2009 Valerio Proietti, <http://mad4milk.net/>
-var clone = this.clone = function(item){
+var clone = exports.clone = function(item){
var cloned;
if (item instanceof Array){
cloned = [];
@@ -28,7 +28,7 @@ mergeOne = function(source, key, current){
return source;
};
-this.merge = function(source, k, v){
+exports.merge = function(source, k, v){
if (typeof k == 'string') return mergeOne(source, k, v);
for (var i = 1, l = arguments.length; i < l; i++){
var object = arguments[i];

0 comments on commit 5e255cc

Please sign in to comment.