kopia lustrzana https://github.com/c9/core
Merge remote-tracking branch 'origin/master' into multi-domain-part-deux
commit
a6428848d2
|
@ -80,8 +80,37 @@ module.exports = function Section(name, description, types) {
|
|||
sections[name].push(section);
|
||||
return section;
|
||||
};
|
||||
|
||||
this.getRoutes = function(){
|
||||
return routes;
|
||||
};
|
||||
|
||||
/**
|
||||
* Mount an existing section on this instance.
|
||||
*
|
||||
* Note that when the first argument is omitted, the section's routes will
|
||||
* be copied onto this instance's routing table.
|
||||
*
|
||||
* @param {string} mountpoint Where to mount this secion, e.g. "/capture/"
|
||||
* @param {Section} section A frontdoor section
|
||||
*/
|
||||
|
||||
this.mount = function(name, section) {
|
||||
if ( arguments.length == 1 ){
|
||||
section = arguments[0];
|
||||
|
||||
if ( ! ( section instanceof Section ) )
|
||||
throw new Error("Single argument to mount must be a Section!");
|
||||
|
||||
var addRoutes = section.getRoutes();
|
||||
|
||||
Object.keys(addRoutes).forEach(function( method){
|
||||
routes[method] = [].concat( routes[method], addRoutes[method] );
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sections[name])
|
||||
sections[name] = [];
|
||||
|
||||
|
@ -89,6 +118,25 @@ module.exports = function Section(name, description, types) {
|
|||
sections[name].push(section);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sortcut for client-side routing without a `next`
|
||||
*
|
||||
* Allows you to omit the third argument, "next" and avoid special
|
||||
* treatment in router.js (see "wrapHandler").
|
||||
*
|
||||
* Has a variable number of argumnets: no need to wrap handlers in an array
|
||||
*/
|
||||
this.on = function( path, handler ){
|
||||
var middlewares = Array.prototype.slice.call( arguments, 1 );
|
||||
handler = middlewares.shift();
|
||||
|
||||
middlewares.unshift(function(req, res, next){
|
||||
handler( req, res, next );
|
||||
});
|
||||
|
||||
this._route( path, { method: "get" }, middlewares );
|
||||
};
|
||||
|
||||
this._rootHandler = function(req, res) {
|
||||
this.handle(req, res, function(err) {
|
||||
if (err) {
|
||||
|
|
|
@ -67,12 +67,12 @@
|
|||
"c9.ide.language.javascript.tern": "#2b0bb024da",
|
||||
"c9.ide.language.javascript.infer": "#cfec494a3c",
|
||||
"c9.ide.language.jsonalyzer": "#ba3e0d298c",
|
||||
"c9.ide.collab": "#b55229eb75",
|
||||
"c9.ide.collab": "#2fc3852058",
|
||||
"c9.ide.local": "#a9703b630c",
|
||||
"c9.ide.find": "#6cc6d3379d",
|
||||
"c9.ide.find.infiles": "#72582de3cd",
|
||||
"c9.ide.find.replace": "#e4daf722b8",
|
||||
"c9.ide.run.debug": "#23a188b91a",
|
||||
"c9.ide.run.debug": "#ae203dce33",
|
||||
"c9.automate": "#47e2c429c9",
|
||||
"c9.ide.ace.emmet": "#0ab4c6cd68",
|
||||
"c9.ide.ace.gotoline": "#4d1a93172c",
|
||||
|
|
|
@ -146,8 +146,8 @@ Vfs.prototype._createEngine = function(vfs, options) {
|
|||
var that = this;
|
||||
|
||||
var engine = new eio.Server({
|
||||
pingTimeout: 5000,
|
||||
pingInterval: 15000,
|
||||
pingTimeout: 60000,
|
||||
pingInterval: 25000,
|
||||
transports: ["polling", "websocket"],
|
||||
allowUpgrades: true,
|
||||
cookie: false
|
||||
|
|
Ładowanie…
Reference in New Issue