aotrautils 0.0.202 → 0.0.205
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.
- aotrautils/aotrautils.build.js +64 -30
- aotrautils/package.json +1 -1
aotrautils/aotrautils.build.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
/*utils COMMONS library associated with aotra version : «1.0.0.000 (19/07/2022-
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1.0.0.000 (19/07/2022-03:26:03)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -4828,7 +4828,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
4828
4828
|
|
|
4829
4829
|
|
|
4830
4830
|
|
|
4831
|
-
/*utils CLIENT library associated with aotra version : «1.0.0.000 (19/07/2022-
|
|
4831
|
+
/*utils CLIENT library associated with aotra version : «1.0.0.000 (19/07/2022-03:26:03)»*/
|
|
4832
4832
|
/*-----------------------------------------------------------------------------*/
|
|
4833
4833
|
/* ## Utility global methods in a browser (htmljs) client environment.
|
|
4834
4834
|
*
|
|
@@ -11678,7 +11678,7 @@ createFusrodaClient=function(doOnClientReady, doOnDataReception, urlParam=null,
|
|
|
11678
11678
|
|
|
11679
11679
|
|
|
11680
11680
|
|
|
11681
|
-
/*utils GEOMETRY library associated with aotra version : «1.0.0.000 (19/07/2022-
|
|
11681
|
+
/*utils GEOMETRY library associated with aotra version : «1.0.0.000 (19/07/2022-03:26:03)»*/
|
|
11682
11682
|
/*-----------------------------------------------------------------------------*/
|
|
11683
11683
|
|
|
11684
11684
|
|
|
@@ -12884,7 +12884,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
|
|
|
12884
12884
|
// MUST REMAIN AT THE END OF THIS LIBRARY FILE !
|
|
12885
12885
|
|
|
12886
12886
|
AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
|
|
12887
|
-
/*utils SERVER library associated with aotra version : «1.0.0.000 (19/07/2022-
|
|
12887
|
+
/*utils SERVER library associated with aotra version : «1.0.0.000 (19/07/2022-03:26:03)»*/
|
|
12888
12888
|
/*-----------------------------------------------------------------------------*/
|
|
12889
12889
|
|
|
12890
12890
|
|
|
@@ -13387,12 +13387,16 @@ WebsocketImplementation={
|
|
|
13387
13387
|
doOnConnection(nodeServerInstance, clientSocket);
|
|
13388
13388
|
|
|
13389
13389
|
|
|
13390
|
+
// DBG
|
|
13391
|
+
lognow("DEBUG : Starting ping-pong with client : clientSocket.id:",clientSocket.id);
|
|
13392
|
+
|
|
13393
|
+
|
|
13390
13394
|
// To make the server aware of the clients connections states :
|
|
13395
|
+
clientSocket.isConnectionAlive=true;
|
|
13391
13396
|
clientSocket.stateCheckInterval=setInterval(()=>{
|
|
13392
13397
|
|
|
13393
13398
|
|
|
13394
|
-
if (clientSocket.
|
|
13395
|
-
clearInterval(clientSocket.stateCheckInterval);
|
|
13399
|
+
if (clientSocket.isConnectionAlive===false){
|
|
13396
13400
|
|
|
13397
13401
|
// TODO : FIXME : DUPLICATED CODE :
|
|
13398
13402
|
// TODO : FIXME : Use one single interface !
|
|
@@ -13402,35 +13406,37 @@ WebsocketImplementation={
|
|
|
13402
13406
|
// TODO : FIXME : DUPLICATED CODE :
|
|
13403
13407
|
if(!empty(nodeServerInstance.onClientLostListeners))
|
|
13404
13408
|
foreach(nodeServerInstance.onClientLostListeners,l=>{l.execute(clientSocket);});
|
|
13409
|
+
|
|
13405
13410
|
|
|
13411
|
+
clearInterval(clientSocket.stateCheckInterval);
|
|
13406
13412
|
return;
|
|
13407
13413
|
}
|
|
13408
13414
|
|
|
13409
|
-
clientSocket.
|
|
13410
|
-
try{
|
|
13415
|
+
clientSocket.isConnectionAlive=false;
|
|
13416
|
+
// try{
|
|
13411
13417
|
|
|
13412
13418
|
// OLD :
|
|
13413
13419
|
// if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.ping();
|
|
13414
13420
|
// else clientSocket.emit("ping");
|
|
13415
|
-
|
|
13421
|
+
|
|
13422
|
+
nodeServerInstance.send("protocol",{type:"ping"});
|
|
13416
13423
|
|
|
13417
|
-
|
|
13418
13424
|
|
|
13419
|
-
}catch(error){
|
|
13420
|
-
lognow("ERROR : A problem occurred when tried to ping client socket : ",error);
|
|
13421
|
-
// We effectively end the client connection to this server :
|
|
13422
|
-
|
|
13423
|
-
// TODO : FIXME : DUPLICATED CODE :
|
|
13424
|
-
// TODO : FIXME : Use one single interface !
|
|
13425
|
-
if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.terminate();
|
|
13426
|
-
else clientSocket.emit("endConnection");
|
|
13427
|
-
|
|
13428
|
-
// TODO : FIXME : DUPLICATED CODE :
|
|
13429
|
-
if(!empty(nodeServerInstance.onClientLostListeners))
|
|
13430
|
-
foreach(nodeServerInstance.onClientLostListeners,l=>{l.execute(clientSocket);});
|
|
13431
|
-
|
|
13432
|
-
return;
|
|
13433
|
-
}
|
|
13425
|
+
// }catch(error){
|
|
13426
|
+
// lognow("ERROR : A problem occurred when tried to ping client socket : ",error);
|
|
13427
|
+
// // We effectively end the client connection to this server :
|
|
13428
|
+
//
|
|
13429
|
+
// // TODO : FIXME : DUPLICATED CODE :
|
|
13430
|
+
// // TODO : FIXME : Use one single interface !
|
|
13431
|
+
// if(!WebsocketImplementation.useSocketIOImplementation) clientSocket.terminate();
|
|
13432
|
+
// else clientSocket.emit("endConnection");
|
|
13433
|
+
//
|
|
13434
|
+
// // TODO : FIXME : DUPLICATED CODE :
|
|
13435
|
+
// if(!empty(nodeServerInstance.onClientLostListeners))
|
|
13436
|
+
// foreach(nodeServerInstance.onClientLostListeners,l=>{l.execute(clientSocket);});
|
|
13437
|
+
//
|
|
13438
|
+
// return;
|
|
13439
|
+
// }
|
|
13434
13440
|
|
|
13435
13441
|
|
|
13436
13442
|
}, nodeServerInstance.clientTimeoutMillis);
|
|
@@ -13439,17 +13445,17 @@ WebsocketImplementation={
|
|
|
13439
13445
|
// // OLD :
|
|
13440
13446
|
// if(!WebsocketImplementation.useSocketIOImplementation){
|
|
13441
13447
|
// clientSocket.on("pong",()=>{
|
|
13442
|
-
// clientSocket.
|
|
13448
|
+
// clientSocket.isConnectionAlive=true;
|
|
13443
13449
|
// });
|
|
13444
13450
|
// }else{
|
|
13445
13451
|
// clientSocket.on("ping",()=>{
|
|
13446
|
-
// clientSocket.
|
|
13452
|
+
// clientSocket.isConnectionAlive=true;
|
|
13447
13453
|
// });
|
|
13448
13454
|
// }
|
|
13449
13455
|
|
|
13450
13456
|
nodeServerInstance.receive("protocol",(message)=>{
|
|
13451
13457
|
if(message.type!=="pong") return;
|
|
13452
|
-
clientSocket.
|
|
13458
|
+
clientSocket.isConnectionAlive=true;
|
|
13453
13459
|
});
|
|
13454
13460
|
|
|
13455
13461
|
|
|
@@ -14244,13 +14250,17 @@ class ListManager{
|
|
|
14244
14250
|
}
|
|
14245
14251
|
|
|
14246
14252
|
isClientActive(clientId){
|
|
14253
|
+
|
|
14254
|
+
// DBG
|
|
14255
|
+
lognow(" this.isSessionActive()",this.isSessionActive());
|
|
14256
|
+
|
|
14247
14257
|
if(!this.isSessionActive()) return false;
|
|
14248
14258
|
const clientPosition=this.getItemPosition(clientId);
|
|
14249
|
-
const result=(clientPosition
|
|
14259
|
+
const result=(clientPosition-1/*Because client position starts at 1 !*/<=this.maxItemsNumber);
|
|
14250
14260
|
return result;
|
|
14251
14261
|
}
|
|
14252
14262
|
|
|
14253
|
-
|
|
14263
|
+
removeItemById(id){
|
|
14254
14264
|
if(id==null){
|
|
14255
14265
|
// TRACE
|
|
14256
14266
|
lognow("ERROR : Cannot remove item, no id specified.");
|
|
@@ -14263,6 +14273,30 @@ class ListManager{
|
|
|
14263
14273
|
}
|
|
14264
14274
|
delete this.itemsInfos[id];
|
|
14265
14275
|
}
|
|
14276
|
+
|
|
14277
|
+
removeItem(item){
|
|
14278
|
+
if(item==null){
|
|
14279
|
+
// TRACE
|
|
14280
|
+
lognow("ERROR : Cannot remove item, none specified.");
|
|
14281
|
+
return;
|
|
14282
|
+
}
|
|
14283
|
+
|
|
14284
|
+
let id=null;
|
|
14285
|
+
foreach(this.itemsInfos,(itemInfos,key)=>{
|
|
14286
|
+
if(itemInfos.item===item){
|
|
14287
|
+
id=key;
|
|
14288
|
+
return "break";
|
|
14289
|
+
}
|
|
14290
|
+
});
|
|
14291
|
+
|
|
14292
|
+
if(!id){
|
|
14293
|
+
// TRACE
|
|
14294
|
+
lognow("ERROR : Cannot remove item, item not found for id «"+id+"».");
|
|
14295
|
+
return;
|
|
14296
|
+
}
|
|
14297
|
+
|
|
14298
|
+
this.removeItemById(id);
|
|
14299
|
+
}
|
|
14266
14300
|
|
|
14267
14301
|
// Goes from 1 to <length>:
|
|
14268
14302
|
getItemPosition(id){
|
aotrautils/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.205",
|
|
4
4
|
"main": "aotrautils.build.js",
|
|
5
5
|
"description": "A library for vanilla javascript utils (client-side) used in aotra javascript CMS",
|
|
6
6
|
"author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",
|