powered by Authenteo
by Xucia  

Learn more

Top Level Functions API

These are top level functions provided by the Authenteo framework. They are included as top level functions because of their frequent usage.

byId(elementId)

This function takes an element id as an argument and returns the corresponding DOM element. This is the same thing as calling:

            document.getElementById(elementId)
          

sleep(milliseconds)

This function pauses execution for the given number of milliseconds. Other threads may execute while this thread is paused and waiting to resume.

spawn(newThreadExpression)

This function causes the provided expression to run as a new thread. That is the expression can execute without blocking the current code if the called code suspends. For example:

            spawn(function() {
            

sleep(1000);

debug("this message will come one second later");

});

debug("This message will come first");

Future()

This constructor function is used to create a notifier function to setup a continuation. This function will return a notifier function. Calling the notifier function will resume a thread. The returned notifier function will have a member function called wait, that when called will suspend the thread. For example, the sleep function above could be written:

            function sleep(milliseconds){
            

var notifier = new Future();

// when the setTimeout is finished it will call the notifier to resume

setTimeout(notifier.fulfill,milliseconds);

// suspend the current thread and wait for setTimeout to trigger

notifier.result();

}

The notifier function can be called with a single argument that is the value that should be returned by the wait function when it is resumed. For example:

            function waitForButtonClick(buttonId) {
            

var notifier = new Future();

events.addListener(byId(buttonId),"click", function(evt) {

notifier(evt);

});

var event = notifier.result();

// event will now hold the event object from the clicking of the button

}

debug(message)

This will log the given message argument to the console (if you are using Firefox) or the bottom of the page (if you are using IE or anything else that does not have a console).

assert(condition)

This will function throw an error if the condition argument passed is false. If the condition is true it will return normally.

Global Variables

pjs.root?This is the root of the entire server persisted object graph. Every server persisted object is a descendent of this object.

website?this is a root of the current website object graph. This contains all the content, layout, and administrative information for a website.

News

Authenteo 1.1 is available.

Firebug - Web Development Evolved Now with Firebug integration . Make changes to CSS and HTML with Firebug and save the changes

Check out press releases and the following articles on Authenteo:

Authenteo beta