DemosThe examples/ directory contains some small (tiny) example applications written in jwacs. Some of those example programs (okay, one) require the server to provide certain services for Ajax requests, so they (okay, it) won't run very well on a local file system. So that you can still see these (this) application in action, we provide running versions of all the example apps here.
- TrivialHttpRequest (see source)
- This trivial little app demonstrates the use of
JwacsLib.fetchData; it fetches a text file from the server and displays it on the page. Note that it is making an asynchronous
XMLHttpRequestrequest, but to the programmer it appears that
fetchDatablocks until complete and then returns the result.
- Counter (see source)
- This application shows a simple counter, and links to make it go up and down. It demonstrates the use of the history (ie, back-button) management capabilities that the jwacs library provides.
- Calendar Mark 2 (see source)
- This slightly more substantial example of a jwacs application implements
a simple web-calendar as a client-side application.
UPDATE 2015-02-16: The server backend is no longer live,
so I've removed the link to the active demo, but the source is still available.
The client expects the server to provide a basic REST-style service that exposes the following endpoints:
- GET /event-query with parameter id: Returns a single event
- GET /event-query with parameters s and e: Returns all events that occur between the start date s and the end date e inclusive.
- POST /event-add with parameters date, desc, and notes: Creates a new event on the specified date with the specified description and notes. Returns the created event if successful.
- POST /event-del with parameter id: Deletes the specified event.
- POST /event-update with required parameter id and optional parameters date, desc, and notes: Updates the specified fields of the specified event.