Added hook for clientVars and hook-doc

This commit is contained in:
mluto 2013-01-14 22:51:26 +01:00
parent 94f9b05c4c
commit 41cb5d8265
2 changed files with 37 additions and 4 deletions

View file

@ -175,6 +175,27 @@ function handleMessage ( hook, context, callback ) {
};
```
## clientVars
Called from: src/node/handler/PadMessageHandler.js
Things in context:
1. clientVars - the basic `clientVars` built by the core
2. pad - the pad this session is about
This hook will be called once a client connects and the `clientVars` are being sent. Plugins can use this hook to give the client a initial configuriation, like the tracking-id of an external analytics-tool that is used on the client-side. You can also overwrite values from the original `clientVars`.
Example:
```
exports.clientVars = function(hook, context, callback)
{
// tell the client which year we are in
return callback({ "currentYear": new Date().getFullYear() });
};
```
This can be accessed on the client-side using `clientVars.currentYear`.
## getLineHTMLForExport
Called from: src/node/utils/ExportHtml.js