[TYPO3-core] RFC #13313: ExtDirect API

Sebastian Kurfürst sebastian at typo3.org
Tue Jan 26 10:35:33 CET 2010


Hey Steffen,

>>> 3) Reflection is used to get number of parameters. Why, for what usage?
>>> Reflection is very expansive call and should be used seldomly.
>> Do you have another way to get the number of parameters for a method?
>> The client-side needs the number of parameters to build the stubs
>> correctly.
> i don't get it, what do you mean with "build the stubs" ?
> For client side JS don't need to define all args in function. Also if
> you code the functions you'd know how many args you use.
> Maybe you can give a short example?
OK; If you have a server side class:
class Foo {
	public function bar($argument1, $argument2) {...}
}
which is available under "TYPO3.Foo" in JavaScript, you can effectively
write:
TYPO3.Foo.bar("arg1", "arg2");

If you want to use a value which is returned, you need to specify a
callback function (in JS) as last parameter, as Ext.Direct is asynchronous:
TYPO3.Foo.bar("arg1", "arg2", function() {... do something after the
method returned ...});

And for that to work, Ext.Direct (on the client side) *must* know the
number of arguments a function has. Thus, we need to provide it ;)

Greets,
Sebastian


More information about the TYPO3-team-core mailing list