Added a userLeave
hook that gets called when a user leaves a pad
This commit is contained in:
parent
49bba7dfe2
commit
2f8b860e69
@ -263,3 +263,20 @@ exports.exportFileName = function(hook, padId, callback){
|
||||
callback("newFileName"+padId);
|
||||
}
|
||||
```
|
||||
|
||||
## userLeave
|
||||
Called from src/node/handler/PadMessageHandler.js
|
||||
|
||||
This in context:
|
||||
|
||||
1. session (including the pad id and author id)
|
||||
|
||||
This hook gets called when an author leaves a pad. This is useful if you want to perform certain actions after a pad has been edited
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
exports.userLeave = function(hook, session, callback) {
|
||||
console.log('%s left pad %s', session.author, session.padId);
|
||||
};
|
||||
```
|
||||
|
@ -145,6 +145,9 @@ exports.handleDisconnect = function(client)
|
||||
|
||||
//Go trough all user that are still on the pad, and send them the USER_LEAVE message
|
||||
client.broadcast.to(session.padId).json.send(messageToTheOtherUsers);
|
||||
|
||||
// Allow plugins to hook into users leaving the pad
|
||||
hooks.callAll("userLeave", session);
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user