Skip to content

Commit

Permalink
pr #72
Browse files Browse the repository at this point in the history
  • Loading branch information
incompl committed Mar 24, 2014
1 parent 8ddd7c8 commit 1c60743
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@
"grunt-contrib-nodeunit": "~0.2.2",
"grunt-contrib-jshint": "~0.7.2",
"express": "~3.4.8"
},
"dependencies": {
"underscore": "~1.6.0",
"socket.io-client": "~0.9.16"
}
}
37 changes: 16 additions & 21 deletions src/client/cloak.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
/* cloak client */
/* global cloak:true,module,io:true,console,_:true */
/* global module,console */

(function(global, factory) {

if (typeof global.define === 'function' && global.define.amd) {
define(['underscore', 'socket.io-client'], factory);
} else if (typeof module === 'object' && module.exports) {
module.exports = factory(
require('underscore'), require('socket.io-client')
);
} else {
global.cloak = factory(global._, global.io);
}

(function() {
})(this, function(_, io) {

var removeKey = function(val, key, obj) {
delete obj[key];
Expand All @@ -18,17 +30,6 @@

var cloak = {

_setLibs: function(a, b) {
_ = a;
io = b;
},

/**
* Set configuration options for Cloak. These options will be applied
* immediately if Cloak has already been started (see `cloak.run`), and
* they will be referenced in all future calls to `clock.run` until
* overwritten.
*/
configure: function(configArg) {

// When specified, the `messages` option should trigger the complete
Expand Down Expand Up @@ -226,11 +227,5 @@

};

if (typeof window === 'undefined') {
module.exports = createCloak;
}
else {
cloak = createCloak();
}

}());
return createCloak();
});
7 changes: 5 additions & 2 deletions test/lib/superSuite.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ module.exports = {
// function instead of doing it manually means clients
// will be properly cleaned up after tests are done.
createClient: function() {
var client = createCloakClient();
client._setLibs(_, io);
var client;

delete require.cache[require.resolve('../../src/client/cloak')];
client = require('../../src/client/cloak');
clients.push(client);

return client;
}

Expand Down

0 comments on commit 1c60743

Please sign in to comment.