alexyoung / ssbx

Unified API for single site browsers

This URL has Read+Write access

alexyoung (author)
Wed Jan 14 07:54:41 -0800 2009
commit  c2a66a977b414c5a69268bba679ab68e6b341dfe
tree    270da0e5655d429be157656cf052465a0320c25a
parent  353773a91dcfe89bb6b7c395a35c4068aacd28e4
ssbx / README.textile
100644 73 lines (44 sloc) 1.961 kb

Introduction

SSBX provides a stupidly simple API for supporting Single Site Browsers (SSB) in your website.

The current version is a basic implementation to test out the feasibility of the concept, and explore how to make a consistent unified API across platforms.

Examples


if (SSBX.isAvailable()) {
  SSBX.log('hello');
  SSBX.notify({ message: 'This is a message', title: 'Title' });
  SSBX.notifyOnce({ message: 'This is a message', title: 'Title', unique_id: 5});
  SSBX.setDockBadge(5);
  SSBX.log(SSBX.availableDriver);
}

You can also only run when there’s a compatible SSB available like this:


SSBX.run(function() {
  SSBX.log('hello');
}

Requirements

SSBX requires Prototype.

Supported SSBs

Notification API

Show a notification (requires Growl in Mac OS). Title is optional.

SSBX.notify({ message: 'This is a message', title: 'Title' })

Show a notification and log it so it doesn’t get displayed again. Logs to a cookie:

SSBX.notifyOnce({ unique_id: 1, message: 'This is a message', title: 'Title' })

SSBX expects a unique integer ID for messages to be handled this way.

Dock badge icons

Only available in Mac OS (until someone offers a Windows equivalent):

SSBX.setDockBadge(3)

Console logging

To make it easier to debug your JavaScript from within an SSB you can use unified console logging:

SSBX.log('Message')

Capabilities

  • Test if the SSB is available: SSBX.isAvailable()
  • Check which SSB is active: SSBX.availableDriver

Drag and drop

Running tests

Run tests inside the appropriate SSB. There’s tests for Bubbles and Fluid.

Library style

I’ve added semicolons to line endings to make compressing/obscuring the library easier (if you do that sort of thing).