Skip to content

Instantly share code, notes, and snippets.

@sgithens
Created September 4, 2014 02:37
Show Gist options
  • Select an option

  • Save sgithens/bb71712356313ae095af to your computer and use it in GitHub Desktop.

Select an option

Save sgithens/bb71712356313ae095af to your computer and use it in GitHub Desktop.
> var logMakeInvoker = l.filter(fluid.activityTrace, function(i) { return i.type === 'makeInvoker'; });
undefined
> log
logInitComponents logMakeInvoker
> logMakeInvoker
[ { type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'ensureResCompleted',
record: [Object],
that: [Object] },
time: 1409790672614 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'attachFluidRequest',
record: [Object],
that: [Object] },
time: 1409790672614 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'onErrorHandler',
record: [Object],
that: [Object] },
time: 1409790672615 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'onSuccessHandler',
record: [Object],
that: [Object] },
time: 1409790672615 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'proceed',
record: [Object],
that: [Object] },
time: 1409790672615 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'getSessionTypeGrade',
record: [Object],
that: [Object] },
time: 1409790672620 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'destroySession',
record: [Object],
that: [Object] },
time: 1409790672621 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'ensureSession',
record: [Object],
that: [Object] },
time: 1409790672621 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'handle',
record: [Object],
that: [Object] },
time: 1409790672625 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'when',
record: [Object],
that: [Object] },
time: 1409790672625 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'ensureResCompleted',
record: [Object],
that: [Object] },
time: 1409790672874 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'attachFluidRequest',
record: [Object],
that: [Object] },
time: 1409790672874 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'onErrorHandler',
record: [Object],
that: [Object] },
time: 1409790672875 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'onSuccessHandler',
record: [Object],
that: [Object] },
time: 1409790672875 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'proceed',
record: [Object],
that: [Object] },
time: 1409790672875 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'getSessionTypeGrade',
record: [Object],
that: [Object] },
time: 1409790672877 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'destroySession',
record: [Object],
that: [Object] },
time: 1409790672878 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'ensureSession',
record: [Object],
that: [Object] },
time: 1409790672878 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'handle',
record: [Object],
that: [Object] },
time: 1409790672881 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'when',
record: [Object],
that: [Object] },
time: 1409790672881 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'ensureResCompleted',
record: [Object],
that: [Object] },
time: 1409790673611 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'attachFluidRequest',
record: [Object],
that: [Object] },
time: 1409790673611 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'onErrorHandler',
record: [Object],
that: [Object] },
time: 1409790673611 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'onSuccessHandler',
record: [Object],
that: [Object] },
time: 1409790673611 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'proceed',
record: [Object],
that: [Object] },
time: 1409790673611 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'getSessionTypeGrade',
record: [Object],
that: [Object] },
time: 1409790673612 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'destroySession',
record: [Object],
that: [Object] },
time: 1409790673613 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'ensureSession',
record: [Object],
that: [Object] },
time: 1409790673613 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'handle',
record: [Object],
that: [Object] },
time: 1409790673615 },
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'when',
record: [Object],
that: [Object] },
time: 1409790673615 } ]
> l.map(logMakeInvoker, function(i) {return i.args.name;});
[ 'ensureResCompleted',
'attachFluidRequest',
'onErrorHandler',
'onSuccessHandler',
'proceed',
'getSessionTypeGrade',
'destroySession',
'ensureSession',
'handle',
'when',
'ensureResCompleted',
'attachFluidRequest',
'onErrorHandler',
'onSuccessHandler',
'proceed',
'getSessionTypeGrade',
'destroySession',
'ensureSession',
'handle',
'when',
'ensureResCompleted',
'attachFluidRequest',
'onErrorHandler',
'onSuccessHandler',
'proceed',
'getSessionTypeGrade',
'destroySession',
'ensureSession',
'handle',
'when' ]
> l.map(logMakeInvoker, function(i, idx) {return [idx, i.args.name];});
[ [ 0, 'ensureResCompleted' ],
[ 1, 'attachFluidRequest' ],
[ 2, 'onErrorHandler' ],
[ 3, 'onSuccessHandler' ],
[ 4, 'proceed' ],
[ 5, 'getSessionTypeGrade' ],
[ 6, 'destroySession' ],
[ 7, 'ensureSession' ],
[ 8, 'handle' ],
[ 9, 'when' ],
[ 10, 'ensureResCompleted' ],
[ 11, 'attachFluidRequest' ],
[ 12, 'onErrorHandler' ],
[ 13, 'onSuccessHandler' ],
[ 14, 'proceed' ],
[ 15, 'getSessionTypeGrade' ],
[ 16, 'destroySession' ],
[ 17, 'ensureSession' ],
[ 18, 'handle' ],
[ 19, 'when' ],
[ 20, 'ensureResCompleted' ],
[ 21, 'attachFluidRequest' ],
[ 22, 'onErrorHandler' ],
[ 23, 'onSuccessHandler' ],
[ 24, 'proceed' ],
[ 25, 'getSessionTypeGrade' ],
[ 26, 'destroySession' ],
[ 27, 'ensureSession' ],
[ 28, 'handle' ],
[ 29, 'when' ] ]
> l[18]
undefined
> logMakeInvoker[18]
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'handle',
record:
{ funcName: 'gpii.securityGateway.verifyLogin',
args: [Object],
dynamic: true },
that:
{ typeName: 'kettle.requests.request.handler',
id: '7fagt5xo-492',
destroy: [Object],
options: [Object],
nickName: 'handler',
events: [Object],
handle: [Function: invokeInvoker],
when: [Function: invokeInvoker] } },
time: 1409790672881 }
> logMakeInvoker[8]
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'handle',
record:
{ funcName: 'gpii.handleUserGet',
args: [Object],
dynamic: true },
that:
{ typeName: 'kettle.requests.request.handler',
id: '7fagt5xo-452',
destroy: [Object],
options: [Object],
nickName: 'handler',
events: [Object],
handle: [Function: invokeInvoker],
when: [Function: invokeInvoker] } },
time: 1409790672625 }
> logMakeInvoker[18]
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'handle',
record:
{ funcName: 'gpii.securityGateway.verifyLogin',
args: [Object],
dynamic: true },
that:
{ typeName: 'kettle.requests.request.handler',
id: '7fagt5xo-492',
destroy: [Object],
options: [Object],
nickName: 'handler',
events: [Object],
handle: [Function: invokeInvoker],
when: [Function: invokeInvoker] } },
time: 1409790672881 }
> logMakeInvoker[28]
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'handle',
record:
{ funcName: 'gpii.handleUserGet',
args: [Object],
dynamic: true },
that:
{ typeName: 'kettle.requests.request.handler',
id: '7fagt5xo-532',
destroy: [Object],
options: [Object],
nickName: 'handler',
events: [Object],
handle: [Function: invokeInvoker],
when: [Function: invokeInvoker] } },
time: 1409790673615 }
> logMakeInvoker[28].args.record.args
[ '{that}',
'{sessionManager}',
'{response}',
'{request}',
'{requestProxy}',
'{request}.req.params.token',
'{preferencesServer}.userSource' ]
> logMakeInvoker[28].args.that.handle
[Function: invokeInvoker]
> console.log(logMakeInvoker[28].args.that.handle+"");
function invokeInvoker() {
if (fluid.defeatLogging === false) {
fluid.pushActivity("invokeInvoker", "invoking invoker with name %name and record %record from component %that", {name: name, record: invokerec, that: that});
}
var togo;
if (fastRec.invoke) {
togo = fastRec.invoke(arguments);
}
else {
var func = fluid.recordToApplicable(invokerec, that);
var args = fluid.makeArray(arguments);
var invokeSpec = fluid.embodyDemands(that, demandspec, args, {passArgs: true});
func = func || (invokeSpec.funcName? fluid.getGlobalValue(invokeSpec.funcName, environment)
: fluid.expandOptions(demandspec.func, that));
if (!func || !func.apply) {
fluid.fail("Error in invoker record: could not resolve members func, funcName or method to a function implementation - got " + func + " from ", demandspec);
}
if (fastRec.noFast !== true) {
fastRec = fluid.makeFastInvoker(invokeSpec, func);
}
togo = func.apply(null, invokeSpec.args);
}
if (fluid.defeatLogging === false) {
fluid.popActivity();
}
return togo;
}
undefined
> logMakeInvoker[28].args.record.args
[ '{that}',
'{sessionManager}',
'{response}',
'{request}',
'{requestProxy}',
'{request}.req.params.token',
'{preferencesServer}.userSource' ]
> logMakeInvoker[28]
{ type: 'makeInvoker',
message: 'beginning instantiation of invoker with name %name and record %record as child of %that',
args:
{ name: 'handle',
record:
{ funcName: 'gpii.handleUserGet',
args: [Object],
dynamic: true },
that:
{ typeName: 'kettle.requests.request.handler',
id: '7fagt5xo-532',
destroy: [Object],
options: [Object],
nickName: 'handler',
events: [Object],
handle: [Function: invokeInvoker],
when: [Function: invokeInvoker] } },
time: 1409790673615 }
> logMakeInvoker[28].args.that.options
{ gradeNames:
[ 'kettle.requests.request.handler.userGet',
'fluid.littleComponent',
'kettle.requests.request.handler',
'kettle.requests.request.deferred',
'fluid.eventedComponent',
'{request}.handlerContext',
'fluid.applyGradeLinkage',
'autoInit' ],
invokers:
{ handle:
{ funcName: 'gpii.handleUserGet',
args: [Object],
dynamic: true },
when:
{ funcName: 'kettle.requests.request.deferred.when',
args: [Object] } },
argumentMap: { options: 0 },
listeners: { onAttach: [ [Object] ] },
events:
{ onCreate: null,
onAttach: null,
onClear: null,
onDestroy: null,
afterDestroy: null } }
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment