claudio
2008-02-07 13:10:03 UTC
After a long ponderation, I've decided to extract networking functions
from the Phone object and packaging them into a couple of new
dedicated classes.
The CURLClient class is a wrapper around the commandline curl
executable. It provides a consistent Javascript API for developers. It
requires the widget object, and can be easily reused in other projects
out of the box.
The WebSMSEngine class, configured with a plugin, is autonomous in
handling all the dialogue with web resources. Plugins must conform to
the WebSMS plugin specification.
WebSMSEngine adopts a delegate pattern. The delegate should implement
a handful of methods that are called when the engine has encountered
an error, has completed the task or needs some information to proceed
(e.g. a CAPTCHA code).
The current implementation requires a CURLClient object to perform
network requests and receive responses, but I plan to add XHR-based
network operations as an option.
CURLClient and WebSMSEngine depend on the extensions defined lib/
Additions.js. Developers who wish to include them in their projects
should include the Additions.js file as well (or, of course, provide
alternative implementations).
Best regards,
Claudio
from the Phone object and packaging them into a couple of new
dedicated classes.
The CURLClient class is a wrapper around the commandline curl
executable. It provides a consistent Javascript API for developers. It
requires the widget object, and can be easily reused in other projects
out of the box.
The WebSMSEngine class, configured with a plugin, is autonomous in
handling all the dialogue with web resources. Plugins must conform to
the WebSMS plugin specification.
WebSMSEngine adopts a delegate pattern. The delegate should implement
a handful of methods that are called when the engine has encountered
an error, has completed the task or needs some information to proceed
(e.g. a CAPTCHA code).
The current implementation requires a CURLClient object to perform
network requests and receive responses, but I plan to add XHR-based
network operations as an option.
CURLClient and WebSMSEngine depend on the extensions defined lib/
Additions.js. Developers who wish to include them in their projects
should include the Additions.js file as well (or, of course, provide
alternative implementations).
Best regards,
Claudio