davinci api
Overview
The $call function provides a utility for calling functions using the davinci dependency injection framework.
Methods
  • method : function that is to be called.
  • args : an object of named arguments. When the inputted method is called, the named parameters in the method are inspected and matched against values in args. If args is undefined, then all parameters are assigned undefined.
  • obj : object that will be assigned to the 'this' reference.
Example 1 is a basic example of using $call to call a function using the davinci dependency injection framework. In this example, the function takes two parameter named 'name' and 'age'. The parameters are set in a dicitonary which is passed to the $call method.

var args = { name:'dan', age:12 };
var method = function(name, age){
   //do something                                            
}
var obj = {};

//calls the method with the given object as "this".
//args is optional
//obj is optional
$call(method, args, obj);
		
Try it!

Contents