-
Notifications
You must be signed in to change notification settings - Fork 23
Home
SpazCore is a set of components designed to make development of Twitter (and other “lifestream” services) clients easier. It is written in JavaScript, and suitable for applications based on AIR, Titanium, and webOS, although most browser engine-based platforms should be able to utilize many aspects.
SpazCore is made up of four major elements: libraries (libs
), helpers
, platform-specific extensions (platforms
), and vendor libraries (vendors
)
These are components that handle more complex functionality. Right now SpazCore has the following libs:
-
SpazCore (
libs/spazcore.js
): the base library -
SpazTwit (
libs/spaztwit.js
): a Twitter API library -
SpazPingFM (
libs/spazpingfm.js
): a Ping.fm library -
SpazPrefs (
libs/spazprefs.js
): a preferences library -
SpazTemplate (
libs/spaztemplate.js
): a simple library for storing and parsing templating methods -
SpazCron (
libs/spazcron.js
): a library for handling repeating tasks
As of this writing, many of these libraries range from “mostly done and usable” to “barely a skeleton.” Additionally, database abstraction and possibly ORM libraries are planned.
Helpers are single-task functions to handle common tasks. All helpers in SpazCore are under the sc.helpers.###
namespace to avoid collisions. Helper definitions are separated by task into different files:
-
Date and Time (
helpers/datetime.js
): functions to handle common date/time tasks, like generating relative time descriptions -
JavaScript (
helpers/javascript.js
): JS language helpers for things like type checking -
JSON (
helpers/json.js
): JSON encoding and decoding helpers (based on the JSON2.js library) -
Strings (
helpers/string.js
): string tasks, like converting URLs and Twitter @usernames into links -
System (
helpers/sys.js
): Platform and OS-related tasks like platform detection and file manipulation. Most of these require loading a platform-specific extension -
View (
helpers/view.js
): Helpers for common view (UI) tasks, like removing duplicate elements in an HTML Twitter timeline -
XML (
helpers/xml.js
): XML processing helpers
SpazCore attempts to provide a common API for its functionality, regardless of the platform. Some functionality requires platform-specific code, such as file operations. To accommodate this, some function definitions in SpazCore are “stubs,” and the developer has to load a platform-specific set of definitions for their target platform. At the moment, platform-specific files are needed for the System helpers and the SpazPrefs library:
platforms/[platform]/helpers/sys.js
platforms/[platform]/libs/spazprefs.js
As of this writing, the SpazPrefs library has not had its platform-specific code separated into platform files.
SpazCore is built on some open-source JS libraries. All of these are stored in the vendors/
folder. These include:
- jQuery: (currently version 1.3.1); used for event handling, AJAX requests, and some View helpers
- JSON2.js: for encoding and decoding JSON safely
- webtoolkit.base64: for generating base64 hashes
We aren’t TDD monkeys or anything, but we’ve attempted to write unit tests where reasonable. Right now we have tests for a few of the string helpers, but we could use a lot more coverage.
jQuery is used for event handling, which means that the application itself needs (I think?) to use jQuery event binding to receive SpazCore’s events. We could make SpazCore more accessible to folks who aren’t as into jQ by utilizing an event system that:
- will work with non-jQuery listeners
- is easily re-definable so folks could patch SpazCore with their own event system as desired
- supports passing data along with the event
It would be best if what we come up with works with jQuery listeners without too much change, as we already have some apps based on the existing jQ event system.
Lots of the libraries just aren’t filled-in yet. They need to be.
SpazPrefs especially has a lot of if (isPlatform) {...}
type code in it, and this needs to be broken out into platforms
.
Photo uploaders? Shortlink services? RSS/ATOM parsers?