since I am using Ext.Direct for the comunication between the Browser and the Server it would be nice to have a the same nice codecompletion I have for my own written classes in Ext for my Direct server Methods.
For Example I have the following Direct Action imlplemented in C# on the Server:
- Code: Select all
/// <summary>
/// Takes the Value of the Parameter Name, adds an "Echo:" and returns it
/// </summary>
/// <param name="name">the string wich should get returned in the way: "Echo: "+ name</param>
/// <returns>Returns "Echo:" + the parameter</returns>
[DirectAction]
public class CallTypes
{
[DirectMethod]
public string Echo(string name)
{
return "Echo: " + name;
}
}
This Class will get sent via my proxy-class as the following description of the function to the Client and Extjs will make the methods availble as normal Javascript functions via Ext.Direct.
- Code: Select all
{ "actions" : {
"CallTypes" : [
{ "formHandler" : false,
"len" : 1,
"name" : "Echo"
}
]
},
"id" : "1",
"type" : "remoting",
}
Since the Direct Actions are in this case written in c# there is of cause no code-completion in the spket.
Because I dont want to jump into the actual C# class to see what parameters are needed in the Direct Method I want to descripe my direct methods in a Javascript file once (I plan to automatically genareate it later ) and give it a documentation as needed in spket. Than I would like to include this file to benefit from the code-completion of spket.
For the simple Echo Function i came up with the following code:
- Code: Select all
/**
* CallTypes Class
* @type {Object}
*/
var CallTypes = {
/**
* Just a sample Remote Function.
* @param {Object} params
* @param {Function} cb the callback Function
* @param {Object} scope the scope to call the Callback in.
*/
Echo : function(params, cb, scope){
return;
}
}
This allows to type in "CallTypes.E" and Press ctrl+space and the it suggests Echo as I want it to be.
Realy Nice...
But....
There is on big thing missing. Since i always try to use the property paramsAsHash (Ext-Specific) the first param is not the param Name its an Object which should contain a property called name.
So whats needed here is a way to descripe the parameter type like that:
- Code: Select all
/**
* CallTypes Class
* @type {Object}
*/
var CallTypes = {
/**
* Just a sample Remote Function.
* @param {Object} params a Hash of Parameter
* @param {String} params.name the string wich should get returned in the way: "Echo: "+ name
* @param {Function} cb the callback Function
* @param {Object} scope the scope to call the Callback in.
*/
Echo : function(params, cb, scope){
return;
}
}
this should make it possiple to write "CallTypes.Echo({na" and get the code-completion for the name Property and descipes it with "the string wich should get returned in the way: "Echo: "+ name"
Is this allready possible? Is it possible to implent it? Would be very helpfull.
best regards Martin
