moussaka-client
Moussaka prototyping framework.
A javascript library that allows you to use javascript applications with theUsage Example
// Instantiate client var client = opts; // Auto detect variable type var aNumber = client; var aString = client; var aColor = client; // Moussaka type // Define specific schema var validatedNumber = client; // Start polling client; whilerunning // Use Moussaka to adjust variables, MoussakaClient will poll for updates // and update the values accordingly. console; console; console; console; // Stop polling afterwards client;
Options
To instantiate MoussakaClient you must pass in an object with the following keys.
Option | Desciption | Default |
---|---|---|
deviceName | The name of the device (i.e. John Smith's PC.) | None |
apiKey | The user API key retreived from the user account settings in Moussaka. | None |
projectId | The project ID retreived from the project view page in Moussaka. | None |
projectVersion | A string specifying the particular version of the project that this library is used in. | None |
serverUrl | The url to your Moussaka server. | http://localhost:3000/ |
pollInterval | The time in milliseconds between each poll to the server. | 1000 |
logLevel | See section below. | 2 (warning) |
Installing
It can be used directly in a node application or in the browser.
In Node:
- Install the package through npm
npm install moussaka-client
- Load the module
var MoussakaClient = ;var client = opts;
In The Browser:
There are a few ways you can use it in the browser:
Get the package through bower:
bower install moussaka-client
The library bundle will be accessible at '/bower_components/moussaka-client/dist/moussaka-client[.min].js'. Then choose your favourite way to load up the module:
- Consume it with CommonJS
var MoussakaClient = ;
- Consume it with RequireJS
;
- Just use it as a global on the window object
var client = opts;
- You could also just use the npm module in node and use Browserify to build your node application for the browser.
Log Level
By passing in a logLevel option you can control the detail of the log messages. The log levels are as follows:
- trace: 0
- info: 1
- warning: 2
- error: 3
- exception: 4
For example, to see only messages that are errors or exceptions, you would pass { logLevel: 3 } to the MoussakaClient constructor.