Example 1. A Few Live Keywords.
The first webktl example shows a
simple example of a handful of service keywords that are made to
update at about 1 Hz. If you inspect the source code, you'll see
that it's ordinary HTML markup, plus these additions:
- It loads the ajax4webktl
library of routines that implement the ajaxian hooks;
- It calls refreshServiceData()
(part of the ajax4webktl
library) to start periodic updates of some KTL keywords;
- It adds special id
attributes on the HTML keyword fields so that refreshServiceData() callback can
find the correct area to update.
And at just 23 lines, it's quite short.
|
|
Example 2. Using Multiple
Services; Putting Live Data into Links.
The second
example shows three KTL services monitored on a single page, and also
illustrates that the ajax4webktl
routines can put the KTL data into any part of an HTML page, not just
into a child text node. Like Example 1, this is laid out without
any CSS to help make it attractive. At 95 lines, it's still
pretty short.
|
|
Example 3. Adding
CSS to a WebKTL Page.
This shows very similar data to that of
Example 2,
but this adds about 150 lines of CSS to make the display more
attractive and have a more useful layout.
|
|
Example 4.
Beyond Monitoring: Instrument Control with WebKTL.
Our last example shows
that it's pretty easy to do instrument control with the webktl tools. This one takes
about 115 lines of HTML and 90 lines of CSS. However, if you
inspect the HTML, you'll see there's a lot of Javascript embedded
within it to implement some of the control features. That's
undesirable -- we want these files to be composed almost entirely of
markup language, not programming language. Therefore, one of our
next steps will be to move the Javascript logic into the ajax4webktl file, and add special
markup attributes to trigger the logic.
|
|