fluid.invoke
This functionality is Sneak Peek status. This means that the APIs may change. We welcome your feedback, ideas, and code, but please use caution if you use this new functionality.
This page is being drafted - some information is still missing.
fluid.invoke()
description
fluid.invoke(functionName, args, that, environment);
File name: FluidIoC.js
Parameters
functionName |
(String) The fully namespaced name of the function to invoke |
args |
(Array) An array of arguments to be applied to the function specified in functionPath . |
that |
(Object) description |
environment |
(Object) (optional) A hash of root path segments to objects that can be used to override lookups to the global object. This would typically be used by the Fluid framework itself to direct lookups to the correct version of the root fluid object |
Return Value
the return value of functionName |
Example
cspace.util.getLoginURL = function (options) { ... }; fluid.defaults("cspace.util.getLoginURL", { url: "%chain/loginstatus" }); fluid.demands("cspace.util.getLoginURL", "cspace.localData", { args: { url: "%webapp/data/loginstatus.json" } }); ... var loginUrl = fluid.invoke("cspace.util.getLoginURL");
In this example, fluid.invoke
will resolve the value to use for the url
option before calling cspace.util.getLoginURL
:
- In a production environment, the default (
"%chain/loginstatus"
) will be resolved and used. - When the
cspace.localData
context is registered (for example, in a testing environment), the alternative specified in the demands block will be found, resolved and used.