08-27-周三_17-09-29

This commit is contained in:
2025-08-27 17:10:05 +08:00
commit 86df397d8f
12735 changed files with 1145479 additions and 0 deletions

59
node_modules/shoe/index.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
var sockjs = require('sockjs');
exports = module.exports = function (opts, cb) {
if (typeof opts === 'function') {
cb = opts;
opts = {};
}
var server = sockjs.createServer();
var handler = function (stream) {
var _didTimeout = stream._session.didTimeout
var _didClose = stream._session.didClose
stream._session.didTimeout = function () {
cleanup()
_didTimeout.apply(this, arguments)
}
stream._session.didClose = function () {
cleanup()
_didClose.apply(this, arguments)
}
cb(stream)
function cleanup() {
stream.emit("close")
if (stream.destroy) {
stream.destroy()
}
}
}
if (typeof cb === 'function') {
server.on('connection', handler);
}
server.install = function (httpServer, hopts) {
if (hopts && hopts.listen && !httpServer.listen) {
httpServer = arguments[1];
hopts = arguments[0];
}
if (typeof hopts === 'string') {
hopts = { prefix : hopts };
}
if (!hopts) hopts = {};
if (hopts.log === undefined) {
// spamming stdout by default is VERY infuriating,
// emit an event instead
hopts.log = function (severity, line) {
server.emit('log', severity, line);
};
}
server.installHandlers(httpServer, hopts);
return server;
};
return server;
};
for (var key in sockjs) {
exports[key] = sockjs[key];
}