Improve this doc

Client-Side Constants

When you load the view in the browser, constants will be defined as global variables, so they can be accessed anywhere by their name.

To define a constant add it under consts: in the view definition.

ss.client.define('myview',{
    view: 'myview.html',
    consts: {
      appConfig: {
        facebookAppId: '1234',
        twitterKey: 'AAA'
      }
    }
});

The constants will only be loaded in the view. Other views will not be affected.

You can also define a global constant using ss.client.send. In this case the constant will be loaded in all views. In case you have a constant in a view definition with the same name, it will be used rather than the global value.

Locals

When you write HTML and CSS you often want to use a common value which isn't defined in the source code, but rather in configuration. Version number and copyright are good examples of these, so are color values, debugging environment and level of browser support.

Following convention these are called locals. They are not available as variables in the browser. That is unless your formatter expose them as such. They are however passed to the template_engines and formatters.

To define a local add it under locals: in the view defintion.

ss.client.define('myview',{
    view: 'myview.html',
    locals: {
      appConfig: {
        copyright: '1999'
      }
    }
});

The locals will only be passed when rendering that view. Other views will not be affected.

You can also define a global local(yes, naming sucks) using ss.client.send. In this case the local will be used in all views. In case you have a local in a view definition with the same name, it will be used rather than the global value.