Essentials of Javascript - Cultural View
Essentials of Javascript - Cultural View
Essentials of Javascript - Cultural View
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Lively Kernel 113<br />
Lively has been used to build simple web sites, including its own tutorial, and also a client-side Wiki system that<br />
stores its pages in an SVN repository. Lively content varies from relatively static pages <strong>of</strong> text to fully dynamic<br />
models that look and behave like flash simulations. The Lively Kernel achieves complex dynamic behavior without<br />
any specific animation support (it does not use the animation features <strong>of</strong> SVG), but by simple scheduling <strong>of</strong> multiple<br />
green-thread processes in JavaScript.<br />
Lively Text and Transformations<br />
The Lively Kernel includes its own multifont text editor written in JavaScript. It includes support for centering,<br />
justification and similar rudimentary text composition capabilities. Working in Lively thus has much the same feel as<br />
working in a web page design program, except that the on-the-fly text layout is not being done in an <strong>of</strong>fline<br />
composition program, but it is in fact the built-in dynamic behavior <strong>of</strong> text in the Lively Kernel.<br />
The liveliness <strong>of</strong> Lively graphics becomes even more apparent when you manipulate the scale and rotation handles<br />
for objects and text. The entire code browser can be used when tilted 20 degrees on its side. Because the text editor is<br />
made up entirely <strong>of</strong> lively graphics, it works perfectly well when rotated or scaled, just as do the scroll bars, clipping<br />
frames, and the rest <strong>of</strong> the entire lively user interface.<br />
Cross-Browser Compatibility<br />
The Lively Kernel depends on browser support for JavaScript and SVG or Canvas graphics, all now part <strong>of</strong> the W3C<br />
standards. At the time <strong>of</strong> writing, this means that it runs in Safari, Firefox, Chrome and Opera browsers.<br />
While this requirement might seem less compatible than HTML, Lively is actually more compatible across the<br />
browsers on which it runs than is HTML. This is because there is greater uniformity among JavaScript, SVG and<br />
Canvas implementations than there is from one HTML implementation to another. Except for one small initial file,<br />
the Lively Kernel code base is entirely free <strong>of</strong> tests for which client browser is being used.<br />
The Lively IDE<br />
Lively includes an integrated development environment <strong>of</strong> considerable power, designed to work via WebDAV with<br />
a local set <strong>of</strong> a dozen or so source JavaScript files synchronizable with an SVN repository. If the user opens a<br />
SystemBrowser, all the JavaScript source files are listed in the file pane <strong>of</strong> the browser. If the user clicks on one <strong>of</strong><br />
these files, it will be read, parsed (by an OMeta JavaScript parser) and displayed similar to a Smalltalk browser with<br />
functions or class definitions listed and, for each class, all the method names are shown. The user can click on a<br />
method name, edit its code in the bottom pane, and then save the new definition. The new definition will be checked<br />
for syntax and, if correct, it will be stored back in the .JS file. Moreover, if in "eval mode" (the usual case), the<br />
method will be redefined in the system that is running. This allows non-critical changes to be made without any need<br />
to restart Lively or any <strong>of</strong> the applications being developed. When all the source files are loaded, a rapid scan will<br />
find every reference to a selected text, and present all the code bodies that match in a separate sub-browser.<br />
The Lively IDE includes object inspectors and morph style panels for controlling fills, borders, and text styles. There<br />
are also facilities for debugging at error points and pr<strong>of</strong>iling for performance tuning, but these have not been pushed,<br />
owing to the improving quality <strong>of</strong> such run-time support in all the major browsers.