angoose
Version:
Angoose is a Remote Method Invocation module that comes with built-in mongoose/angular support. Now you can call server side module in browser just like you're in the server side!
55 lines (45 loc) • 1.25 kB
JavaScript
// ### API References
var Principal = require("./Principal");
var seqnum = 100;
function Context(properties){
this.seqnum = properties.seqnum || (++seqnum);
var props = properties;
this.request = props.request;
this.response = props.response;
// ** getRequest() **
//
// Returns the express request object
this.getRequest = function(){
return props.request;
}
// ** getResponse **
//
// Returns the express response object
this.getResponse = function(){
return props.response;
}
// ** getInvocation **
//
// Returns the invocation object associated with current context
this.getInvocation = function(){
return this.invocation;
}
this.setUser = function(user){
this.user = user;
}
this.getUser = function(){
return this.user;
}
this.setPrincipal = function(principal){
props.principal = principal;
}
// not used yet
this.getPrincipal = function(){
if(props.principal) return props.principal;
return new Principal();
}
this.toString = function(){
return "[Context@"+ this.seqnum+"]"
}
}
module.exports = Context;