Hi again Olli!
I think I'm going to have to steal the "@" notation you use to identify
the other end of the conversation in your posts - it's quite funky.
I'm thinking of something a bit more generic, but very much along the
lines of what you've outlined.
Given that qooxdoo is currently a client-side only framework, we should
do our best to assume nothing about the server side. That said, your
code is still totally valid, but I think that we would be better off
providing hooks for developers to insert their own marshalling and
end-point determination code. For example:
ac = new QxAJAXClient();
ac.addEventListener("determinetarget", determineTarget);
ac.addEventListener("marshallinput", marshallInput);
ac.addEventListener("commandcomplete", doSomethingAppropriate);
Perhaps "determinetarget" is too broad, given that some systems use a
combination of GET and POST submission. For instance often you'll see in
some systems is the target being
"http://www.server.com/func.php?objectid=123&event=click". To allow for
that possibility, perhaps we should have something like:
ac.addEventListener("determineurl", determineURL);
ac.addEventListener("determinegetstring", determineget);
Additionally, the serialisation mode would definitely be settable:
ac.setSerialisationMode(QxAJAXClient.JSON);
or
ac.setSerialisationMode(QxAJAXClient.XML);
and so on.
If none of the built-in options were acceptable, once again we could
raise an event:
ac.addEventListener("encodepayload", encodePayload);
Potentially, one may want to separate this from the "marshallinput"
event that's been used as an example above, to ensure that determining
what data to send to the server and how to encode that data are properly
separated, given that they are separate concerns and the fact that
policy should always be separate from mechanism.
What are your thoughts?
Best regards,
Chris
Oliver Vogel wrote:
@chris
What i think the component need to have is the possibility to add
some "functionName" to it. For example (pseudocode)
ac = new QxAJAXClient();
ac.addBinding("getUserName", "http://myserver.com/test.php",
getUserName(userName));
ac.addBinding("getPhoneNumer", "http://myserver.com/test.php",
getPhoneNUmber(number);
ac.callFunction("getUserName", "someData");
This code means, that there is a "HTML-Page" test.php which implements two
functions:
"getUserName" and "getPhoneNumber". The last line calls the function
"getUserName" in this page and sends the data "someData" to this function.
When the server returns the result, the javaScript - function
getUserName(userName) is called to handle the result.
For marshalling the data to the server and vice versa json is a good idear
(i think).
My implementation was very easy, the method "addBinding" sends two strings
to the server:
1) the name of the Function
2) the data itself (would be a nice idear ;-)
The server site (i wrote in php) looks linke this (in this early state i
don't use JSON):
$functionName = $_POST['functionName');
$data = $_POST['data'];
If ($functionName == 'getUserName') return getUserName(data);
If ($functionName == ...
...
..
I hope this helps
Olli
==================================================
Diplom-Informatiker
Oliver Vogel
Geschaeftsfuehrer
Meins und Vogel GmbH E-Mail: [EMAIL PROTECTED]
Esslinger Str. 45 Tel.: +49 (7153) 6136-20
Fax: +49 (7153) 6136-99
D 73207 Plochingen http://www.muv.com/
Handelsregister: Esslingen am Neckar HRB 3536
Geschäftsführer: Dipl.-Inf. Klaus Meins
Dipl.-Inf. Oliver Vogel
==================================================
"wer Rechtschreibfehler findet darf sie behalten"
-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Im Auftrag
von [EMAIL PROTECTED]
Gesendet: Donnerstag, 17. November 2005 01:49
An: [email protected]
Betreff: Re: AW: [qooxdoo-devel] JavaScript event model
Hi Olli!
Your German -> English translation is better than most of the
text I see
written by native English speakers at my uni, so relax. :-)
Although my object may "sound" better to you, any opinions,
insights or
comments you have would be greatly appreciated if you decide to stop
working on it. The reason I so enjoy working on open source
software is
the collaborative aspect and the fact that you've already
started and have
done some research means that, at the very least, there should be some
dialog before anything goes ahead.
Best regards,
Chris
@chris, @sebastian
I wasn't at office til now, so i couldn't read this tast til now.
If you (chris) are working on such a Object, i stop working
on my own
(because i think, we need only ONE component and yours
"sounds better"
than
mine ( i hope, this german -> english translation is correct)).
Do send "readable" data from the client to the server and
back, i had a
look
at json
http://www.crockford.com/JSON/index.html
Because this is available at many targets.
Maybe you have a look at it too.
Olli
=================================================Diplom-Informatiker
Oliver Vogel
Geschaeftsfuehrer
Meins und Vogel GmbH E-Mail: [EMAIL PROTECTED]
Esslinger Str. 45 Tel.: +49 (7153) 6136-20
Fax: +49 (7153) 6136-99
D 73207 Plochingen http://www.muv.com/
Handelsregister: Esslingen am Neckar HRB 3536
Geschäftsführer: Dipl.-Inf. Klaus Meins
Dipl.-Inf. Oliver Vogel
================================================="wer
Rechtschreibfehler
findet darf sie behalten"
-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Im Auftrag
von Sebastian Werner
Gesendet: Mittwoch, 16. November 2005 13:03
An: [email protected]
Betreff: Re: [qooxdoo-devel] JavaScript event model
Chris Ricks schrieb:
Hi all,
In my development of this AJAX thingy, I'm considering a
few issues
before I finalise my design and decide which
prototype(s) of mine I
continue with. Essentially, I'm after an answer on the
following question:
For events that are either triggered at a given time or
from an external
source (such as user input, an XMLHttpRequest
returning), do these
events just get put at the end of the JavaScript
interpreter's event
queue or will they actually interrupt current operations?
I realise that I'm asking a question that is potentially
very browser
specific and I expect the answer to mean that race hazards
can't happen
(IE: JavaScript interpretation is event driven as opposed
to threaded or
the like).
All comments, regardless of authority, certainty or relevance are
welcome and invited!
In my opinion each event gets it place in the queue and will be
processed after the current running method. Im JavaScript you
don't have
threads, so I think the browser just put the mouse/input/ajax
event to
its queue and will flush it one after another.
Best regards,
Sebastian
Best regards,
Chris
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get
Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more
info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get
Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more
info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get
Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&op=click
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&op=ick
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&op=click
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&op=click
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel