Invoker

Injectable as: invoker

Utility for invoking functions server-side with custom and standard injections.

getParameterNames(fn)

Extracts names of parameters from a js function

Arguments
  • fn (function) –

Returns

Array.<string> – parameter names

invokeInjected(fnToInvoke, injectedParamMap, fnThis)

invokes a function, injecting the arguments from injetedParamMap

Arguments
  • fnToInvoke (function) – function to invoke

  • injectedParamMap (object) – parameters to inject into invocation, keyed by name

  • fnThis (object) – the this context provided on invocation

Returns

the return value of the invoked function

invokeAndReturnPromise(fnToInvoke, injectedParamMap, fnThis)

invokes a function, injecting the arguments from injetedParamMap, wrapping return value of invocation in promise (if it isn’t one already)

Arguments
  • fnToInvoke (function) – function to invoke

  • injectedParamMap (object) – parameters to inject into invocation, keyed by name

  • fnThis (object) – the this context provided on invocation

Returns

Promise resolving to return value of the invoked function

refreshCodeModules()

Refresh cache of CodeModules from database

Returns

Promise resolving when refresh is complete