Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2909bc16f5 | |||
| 4852da9bd5 |
@@ -1,3 +1,8 @@
|
||||
## 1.0.3
|
||||
### Bugfixes
|
||||
- `executeFor` functions will no longer fail with an exception if a function scheduled to be called by the local user throws.
|
||||
|
||||
|
||||
## 1.0.2
|
||||
### New API endpoints
|
||||
- Added `executeForOthers` and `executeForOtherGMs` that execute for all users/all GMs except the local client.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "socketlib",
|
||||
"title": "socketlib",
|
||||
"description": "A library for easier handling of foundry sockets",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"minimumCoreVersion" : "0.7.9",
|
||||
"compatibleCoreVersion" : "0.8.1",
|
||||
"library": true,
|
||||
@@ -17,7 +17,7 @@
|
||||
"src/socketlib.js"
|
||||
],
|
||||
"url": "https://github.com/manuelVo/foundryvtt-socketlib",
|
||||
"download": "https://github.com/manuelVo/foundryvtt-socketlib/archive/v1.0.2.zip",
|
||||
"download": "https://github.com/manuelVo/foundryvtt-socketlib/archive/v1.0.3.zip",
|
||||
"manifest": "https://raw.githubusercontent.com/manuelVo/foundryvtt-socketlib/master/module.json",
|
||||
"readme": "https://github.com/manuelVo/foundryvtt-socketlib/blob/master/README.md",
|
||||
"changelog": "https://github.com/manuelVo/foundryvtt-socketlib/blob/master/CHANGELOG.md",
|
||||
|
||||
@@ -109,10 +109,15 @@ class SocketlibSocket {
|
||||
async executeForAllGMs(handler, ...args) {
|
||||
const [name, func] = this._resolveFunction(handler);
|
||||
this._sendCommand(name, args, RECIPIENT_TYPES.ALL_GMS);
|
||||
if (game.user.isGM)
|
||||
// TODO Make this function call run async, even if the function isn't delcared as async to prevent exceptions to propagate through executeForUsers
|
||||
if (game.user.isGM) {
|
||||
try {
|
||||
func(...args);
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async executeForOtherGMs(handler, ...args) {
|
||||
const [name, func] = this._resolveFunction(handler);
|
||||
@@ -122,8 +127,11 @@ class SocketlibSocket {
|
||||
async executeForEveryone(handler, ...args) {
|
||||
const [name, func] = this._resolveFunction(handler);
|
||||
this._sendCommand(name, args, RECIPIENT_TYPES.EVERYONE);
|
||||
// TODO Make this function call run async, even if the function isn't delcared as async to prevent exceptions to propagate through executeForUsers
|
||||
try {
|
||||
func(...args);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async executeForOthers(handler, ...args) {
|
||||
@@ -139,10 +147,15 @@ class SocketlibSocket {
|
||||
if (currentUserIndex >= 0)
|
||||
recipients.splice(currentUserIndex, 1);
|
||||
this._sendCommand(name, args, recipients);
|
||||
if (currentUserIndex >= 0)
|
||||
// TODO Make this function call run async, even if the function isn't delcared as async to prevent exceptions to propagate through executeForUsers
|
||||
if (currentUserIndex >= 0) {
|
||||
try {
|
||||
func(...args);
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_sendRequest(handlerName, args, recipient) {
|
||||
const message = {handlerName, args, recipient};
|
||||
|
||||
Reference in New Issue
Block a user