The Golf Web Application Server home roadmap1.0 help rss

Conventions 2: Global Variables And Reserved Names

28 Dec 2009 - Micha Niskin

The Golf JavaScript environment includes a number of global variables and functions. Additionally, the Golf framework requires exclusive use of certain CSS class names and/or ids. And finally, there are a few naming conventions which should be kept in mind when developing Golf apps.

Global Variables

These variables are defined in the global scope, and initialized before any other code is run (including jQuery itself). This means that JS code in controllers, plugins, libraries, and components will all have access to them.

<bool> serverside
This variable is true when the app is running in proxy mode (i.e. client does not have JS enabled, and the page is being rendered on the server). This is useful, e.g. when you want to provide separate implementations for JS and no-JS clients.
<string> sessionid
The session id string for the the Golf servlet session.
<string> servletUrl
The URL of the Golf servlet. Since Golf apps never reload the page, this is like a base URL. You navigate around the app by setting the URL hash, or fragment.
<string> urlHash
This is the initial request URL hash. Most of the time this will be an empty string, however in some rare cases it is not. It’s used internally during the bootstrapping process.
<bool> devmode
This variable is true when app is running in local development mode.
<bool> forcebot
This variable is true if the Golf container is running the app in forcebot mode.
<bool> forceproxy
This variable is true if the Golf container is running the app in forceproxy mode.
<bool> forceclient
This variable is true if the Golf container is running the app in forceclient mode.
<string[]> restBackends
This variable is an array of strings—each string corresponding to a backend servlet that has been loaded into the servlet container.
<string> cloudfrontDomain
The Amazon Cloud Front domain name for an AWS deployed app. It’s used internally.

Global Functions

These are the global JS functions, classes and constructors.

<null> d( <string> )
Print debugging output to the console.
Component
asdf
blog comments powered by Disqus
Fork me on GitHub