Documentation generator: JsDoc Toolkit 2.3.2
Template: Codeview 1.2
Generated on: 2011-0-18 14:43

Namespace SimpleStorage

Namespace Summary
Constructor Attributes Constructor Name and Description
 
The global SimpleStorage object.

Method Summary

Method Attributes Method Name and Description
<static>  
SimpleStorage.createCpsStyle(aTblName)
Probably the easiest style to use.
<static>  
SimpleStorage.createIteratorStyle(aTblName)
This is another version of the API that offers the appearance of a synchronous API.
<static>  
SimpleStorage.createPromisesStyle(aTblName)
<static>  
SimpleStorage.spin(f)
The main driver function for the iterator-style API.

Namespace Detail

SimpleStorage
The global SimpleStorage object. It has various method to instanciate a storage session with a given style. You should not have two different styles of API open at the same time on the same table.

Method Detail

  • <static> {SimpleStorageCps} SimpleStorage.createCpsStyle(aTblName)
    Probably the easiest style to use. Function just take a callback (or continuation) that will be called once the asynchronous storage operation is done.
    Parameters:
    {String} aTblName
    The table name you wish to use. You can prefix it with your extension's GUID since it will be shared by all extensions running on the same profile.
    Returns:
    {SimpleStorageCps}
  • <static> {SimpleStorageIterator} SimpleStorage.createIteratorStyle(aTblName)
    This is another version of the API that offers the appearance of a synchronous API. Basically, a call to get now returns a function that takes one argument, that is, the function that it is expected to call to restart the original computation. You are to use it like this:
     let ss = SimpleStorage.createIteratorStyle("my-tbl");
     SimpleStorage.spin(function anon () {
       let r = yield ss.get("myKey");
       // do stuff with r
       yield SimpleStorage.kWorkDone;
       // nothing is ever executed after the final yield call
     });
    
    What happens is the anon function is suspended as soon as it yields. If we call f the function returned by ss.get("myKey"), then spin is the driver that will run f. Spin passes a function called "finish" to f, and once f is done fetching the data asynchronously, it calls finish with the result of its computation. finish then restarts the anon function with the result of the yield call being the value f just passed it.
    Parameters:
    {String} aTblName
    Returns:
    {SimpleStorageIterator}
  • <static> SimpleStorage.createPromisesStyle(aTblName)
    Parameters:
    aTblName
  • <static> SimpleStorage.spin(f)
    The main driver function for the iterator-style API.
    Parameters:
    f