This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//main.js | |
var util = require('util'); | |
util.debug('main initializing'); | |
var someMod = require('./someModule').makeApp('SomeApp', 'Tom'); | |
someMod.displayAppName(); | |
someMod.displayUserName(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//main.js | |
var util = require('util'); | |
util.debug('main initializing'); | |
var someMod = require('./someModule')('SomeApp', 'Tom'); | |
someMod.displayAppName(); | |
someMod.displayUserName(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//main.js | |
var util = require('util'); | |
util.debug('main initializing'); | |
var someMod = require('./someModule')('SomeApp', 'Tom'); | |
someMod.displayAppName(); | |
someMod.displayUserName(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var someFunc = new (function() { | |
var me = this, | |
foobar = "twenty"; | |
me.something = "foo"; | |
somethingElse.on('someEvent', function() { | |
//this points to somewhere else now | |
me.something = 'hi'; | |
foobar = 42; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var http = require('http'); | |
var events = require('events'); | |
var MyServer = new function() { | |
var server = Object.create(new events.EventEmitter); | |
server.on("response", function(response) { | |
response.writeHead(200, {'Content-Type': 'text/plain'}); | |
response.end('Hello World\n'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//handles audio information of clients, eg. codecs they can play | |
module.exports = function(availClients, unavailClients, io) { | |
var util = require('util'); | |
//for each connection | |
io.sockets.on('connection', handleConnection); | |
function handleConnection (socket) { | |
//fired when the client discovered it's codec capabilities | |
socket.on('codecCapability', function (mp3, mp4, ogg) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (mediator) { | |
mediator.once('boot.ready', f); | |
}; | |
var f = function() { | |
//UGH! MAKES EVERY MODULE CODE START WITH 1 INDENTS... solution? | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Mage = { | |
cast: function _cast() { | |
console.log(this.name + ' cast ' + magic); | |
} | |
}; | |
var BlackMage = { | |
fira: function _fira() { this.cast('fira') }, | |
watera: function _watera() { this.cast('watera') } | |
blizarra: function _blizarra(){ this.cast('blizarra') } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof(Name) === 'undefined') { | |
(function(global) { | |
"use strict"; | |
function defineNamespace(object, namespace) { | |
var privates = Object.create(object), | |
base = object.valueOf; | |
Object.defineProperty(object, 'valueOf', { | |
value: function valueOf(value) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([/* dependencies */], function(dep){ | |
return { | |
"test my module": function (test) { | |
// run test | |
} | |
}; | |
}); |
OlderNewer