@trap_stevo/filetide-client 0.0.31 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/FileTideClient.js +21 -9
- package/package.json +2 -2
|
@@ -162,7 +162,7 @@ class FileTideClient {
|
|
|
162
162
|
console.log(this.applyGradient(message, "neutral"));
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
broadcastClientOffline(fileMessager) {
|
|
165
|
+
broadcastClientOffline(fileMessager, forceBroadcast = false) {
|
|
166
166
|
if (fileMessager && !this.clientDisconnected) {
|
|
167
167
|
this.clientDisconnected = true;
|
|
168
168
|
const transferStates = fileTide.getTidingTransferStates();
|
|
@@ -172,23 +172,35 @@ class FileTideClient {
|
|
|
172
172
|
disconnectedDuringTransfer: transferStates.size > 0 ? true : false
|
|
173
173
|
});
|
|
174
174
|
FileTide.outputGradient(`[${this.deviceName}] Disconnected from the file net.`, ["#00C897", "#00E0FF"]);
|
|
175
|
+
return;
|
|
175
176
|
}
|
|
177
|
+
if (!fileMessager || !forceBroadcast) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
this.clientDisconnected = true;
|
|
181
|
+
const transferStates = fileTide.getTidingTransferStates();
|
|
182
|
+
fileMessager.clientTide.emitEvent(this.deviceName, "client-offline", {
|
|
183
|
+
clientID: this.deviceName,
|
|
184
|
+
connectionID: this.connectionID,
|
|
185
|
+
disconnectedDuringTransfer: transferStates.size > 0 ? true : false
|
|
186
|
+
});
|
|
187
|
+
FileTide.outputGradient(`[${this.deviceName}] Disconnected from the file net.`, ["#00C897", "#00E0FF"]);
|
|
176
188
|
}
|
|
177
|
-
async closeAllClients(onClientDisconnect, onCompletion) {
|
|
189
|
+
async closeAllClients(onBeforeClientDisconnect, onClientDisconnect, onCompletion) {
|
|
178
190
|
await fileTide.stopAllMessagers(async (...data) => {
|
|
179
191
|
this.broadcastClientOffline(this.fileMessagerInstance);
|
|
180
|
-
if (typeof
|
|
181
|
-
|
|
192
|
+
if (typeof onBeforeClientDisconnect === "function") {
|
|
193
|
+
await onBeforeClientDisconnect(...data);
|
|
182
194
|
}
|
|
183
|
-
}, onCompletion);
|
|
195
|
+
}, onClientDisconnect, onCompletion);
|
|
184
196
|
}
|
|
185
|
-
async closeClient(userID, onDisconnect, onCompletion) {
|
|
197
|
+
async closeClient(userID, onBeforeDisconnect, onDisconnect, onCompletion) {
|
|
186
198
|
await fileTide.stopMessager(userID, async (...data) => {
|
|
187
199
|
this.broadcastClientOffline(this.fileMessagerInstance);
|
|
188
|
-
if (typeof
|
|
189
|
-
|
|
200
|
+
if (typeof onBeforeDisconnect === "function") {
|
|
201
|
+
await onBeforeDisconnect(...data);
|
|
190
202
|
}
|
|
191
|
-
}, onCompletion);
|
|
203
|
+
}, onDisconnect, onCompletion);
|
|
192
204
|
}
|
|
193
205
|
startClient(clientOptions = {}, connectionOptions = {}, transportOptions = {
|
|
194
206
|
parallelChunks: 3,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trap_stevo/filetide-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"description": "Seamless, real-time file transfers between devices with effortless connectivity. Allowing for powerful, instant, secure, and cross-platform file sharing, enabling efficient and reliable data transfers in any network environment.",
|
|
5
5
|
"main": "dist/cjs/FileTideClient.js",
|
|
6
6
|
"exports": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"author": "Steven Compton",
|
|
38
38
|
"license": "See License in LICENSE.md",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@trap_stevo/filetide": "^0.0.
|
|
40
|
+
"@trap_stevo/filetide": "^0.0.61",
|
|
41
41
|
"@trap_stevo/iotide": "^0.0.43",
|
|
42
42
|
"@trap_stevo/legendarybuilderpronodejs-utilities": "^1.0.43",
|
|
43
43
|
"chalk": "^4.1.2",
|