API for Spotlight - Demo Page
Full featured, compact javascript API to spotlight. Library is clean and compact, built using solid OO javascript patterns. The API provides the following features:
- asynchronous, cross domain!, data connections library
- "manager" objects for data retrieval/rendering
- properly designed OO Javascript - rendering handled by renderer objects which can be overriden
- objects have usable default presentations and CSS controls 100% of the look
- in a nutshell, you get a DHTML news reader, a picture browser/slideshow and coming soon, video browsing
- can be used to build more complex spotlight widgets
- fully standalone, single js file, can be used with other/existing JS frameworks
- solid and compact (<14k - with comments, under 400 lines)
A demo of the library can be seen in action on my site. The library is available as a single JS file.
CODE EXAMPLE:
...
...
<div id="topHeadlines">loading headlines...</div>
<script type="text/javascript">
var topHeadlines = new spotlight.data.newsManager('topHeadlines', '**YOUR API KEY**', 'rssItems', 'rssItem', true, 150);
topHeadlines.getData('us', 'hotStocksNews');
</script>
...
NOTE:
The asynchronous communication is fully encapsulated in the manager object, however, this all works by convention to reduce the overall amount of code required to get it running. In order for everything to work, one simple rule of thumb: ALL of the following items MUST be named the SAME thing:
- JS object instance (variable name)
- the id passed to the JS constructor
- the DOM element id
Support
- Login or register to post comments
- Printer friendly version

