Evgenios Skitsanos Evgenios Skitsanos Moderator

JavaScript core modules are uploaded as build 1.7

Hi there everyone, Busy times not allows to post here too often, guess more updates you can get from my blog at http://blog.skitsanos.com/

So, if you followed latest developments, there are slight changes in WAML JavaScript core, today's build you can find on http://waml.googlecode.com/svn/trunk/1.7/

At this moment nothing related to markup, but more about core functionality, string, array and etc functions, loading content via XmlHttpRequest and dozens of other things...

One more thing coming next is dynamic form rendering that allows to render input form with all javascript processing behind out of XML string or file that represents form fields...

Will keep you updated via my blog.

Cheers,
Evi.

Evgenios Skitsanos Evgenios Skitsanos Moderator

WAML JavaScript Core v.1.6 released

WAML (Webware Application Markup Language) JavaScript core build version 1.6 available for download from http://code.google.com/p/waml/source/browse/trunk/1.6/

Sample of using Waml.Events:

Waml.Events.attach(window, "load", function(){
Waml.Events.attach(window, "keyup", function(ev){
ev = ev || window.event;
keyCode = Number(ev.keyCode) || Number(ev.which);
if (keyCode == 27)
{
alert("pressed");
}
});
});

This example shows how to "listen" to browser window event and when it fired assign keyup handler that will pop-up alert box if key 27 (Escape key) was pressed and released.

Evgenios Skitsanos Evgenios Skitsanos Moderator

Working with Waml.Http

In Waml 1.5 i moved out HTTP part away from Waml.Utils and allocated in within Waml.Http. The reason i did this is because these days Backbase guy, Sergey Ilinksy (http://www.ilinsky.com/) released his nice XmlHttpRequest wrapper that i consider as better implementation of HTTP handling, then Adoeb Spry ones that i was using earlier. I really recommend to look into Sergey's post at: http://www.ilinsky.com/articles/XMLHttpRequest/

Ok, now little sample of how to open HTTP connection on certain URL and post there some data:

//Post data to the url and return reply from server into text container
Waml.Http.open("POST", "/waml/rpc.aspx", true, function(req){$("FrontPage").innerHTML = req.responseText;}, function(req){ $("FrontPage").innerHTML = req.responseText;}, {postData: "xx=111&bbb=222"});

Waml.Http.open(method, url, async, result, fault, options), where:
* method - HTTP method, like POST, GET, HEAD, PUT....
* url - location of the resource
* result - callback function for positive results (200 OK)
* fault - callback function for negative results (404, 500)
* options - array of options, for the moment "postData" is the only option

cheers,
Evi.

Evgenios Skitsanos Evgenios Skitsanos Moderator

Working with events in WAML via JavaScript

Hi there folks!

There are little changes in Waml.Events section, now you have 3 functions to handle events:

Waml.Events.attach (DOM_Object, "event_name", handler_function()); - to attach event to dom object
Waml.Events.dettach (DOM_Object, "event_name", handler_function()); - to detach event from dom object;
Waml.Events.dettachAll (DOM_Object); - to detach all events from dom object

Example:

Waml.Events.attach(window, "load", function(){
alert("loaded");
});

To download Waml core, please look at http://demos.skitsanos.com/waml/waml.js