Web Mode

Web mode for Swiby is just web you know today, but with a different technology for the rendering of pages.

(Also referred to as "The Sweb" - The Swing Web).

The premise is that instead of HTML+JavaScript there a just Swiby page,. Swiby pages-

  • are either static on the web server or part of a dynamic application ( think Ruby on Rails or Waffle making Swiby pages instead of HTML+JS )

  • have flow control - the eqivalent of <a href="nextpage.rb">next page</a> will exist as a function on a 'context' object that is in scope. Invocation of approprate functions on the context object, implicitly causes the current page to be exited.

  • being text over the wire, are indexable by search engines (assuming an upgraded to be able to parse them).

  • like web pages, have a low startup and upgrade cost for end-users

  • unlike web pages, are a single language (JRuby) rather than two (HTML + JavaScript)

Context API

Pages interact with the browser for a number of operations using a context API. There are a number of functions the page can invoke:

goto <page> - causes the current page to be dispensed with and <page> to be loaded instead (via HTTP GET)

exit - the browser will quit the current page

back - the browser will go back to the page displayed before the current one

forward - the browser will dispense with the current page, and go one 'forward' from it (the user must have pressed the back button for this to make sense).

first_page? - returns true if this is the first Swiby page that the browser has dislayed

last_page? - returns true if this is the last Swiby page that the browser has dislayed (the user must have pressed the back button for this to be false).

register_title <t> - sets the title of a page, for use after the page has been displayed

width <w> - sets the width of the page

height <h> - sets the height of the page

title <t> - sets the title of the page on initial load

Open Questions

HTML browsers have back, forward, stop, reload buttons for navigation. With Swiby we are trying to emulate that set of buttons and browser operations.

We are, though, considering some alternatives for the context API:

Exit hooks - Pages as well as specifying content, can specify a function that would allow for last minute actions - "you have not saved this data". That implies the possibility of vetoing the exit of the page. If that is possible, then the browser needs to expose the exit button in the tool to allow the user to leave a potentially malicious application that keeps vetoing page changes.

A push / pop model - The context has functions push and pop. push takes a page argument, and pop does not. Its a true stack model, that would be kinder to breadcrumb style applications.