Biscuits are analgous to the browser concept of cookies, but only exist on the client side of a Vexi application by default (whereas cookies are transmitted over http). Using the vexi.biscuits object, you can store an arbitrary set of information e.g. in XML or JSON format. The important aspect of biscuits is that they are stored against the URL of the application launcher. A biscuit is a stream, thus reading and writing to properties on the vexi.biscuits object is handled in the same manner as accessing Streams.

Biscuits as JSON

Perhaps the easiest way to store biscuits is using JSON.

To store a JS object as a biscuit:

var biscuit = vexi.biscuits["biscuit_name"];
var write_object = { foo:"bar" };
var write_string = vexi.js.stringify(write_object);;

To read a biscuit back into a JS object:

 var read_string =["biscuit_name"]).all;
 var read_object = vexi.js.eval("return "+read_object+";");


Copyright © 2011 The Vexi Project (