mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-25 09:56:15 -04:00
Added hook for clientVars and hook-doc
This commit is contained in:
parent
94f9b05c4c
commit
41cb5d8265
2 changed files with 37 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue