Skip to content

Commit

Permalink
🧠 Include web/assets/js/app/io-client.js
Browse files Browse the repository at this point in the history
  • Loading branch information
tbaltrushaitis committed Sep 16, 2023
1 parent 84956e8 commit 1140325
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ EQUALS = =

## ======================================================================== ##
# $(shell [ -f ./NODE_ENV ] || cp -prv config/.NODE_ENV "./";) ;
$(shell if [ ! -f ./.env ] 2>/dev/null; then cp -prv src/.env ./ ; fi;) ;
$(shell if [ ! -f ./.bowerrc ] 2>/dev/null; then cp -prv config/.bowerrc ./ ; fi;) ;
$(shell if [ ! -f ./.env ] 2>/dev/null; then cp -prv src/.env ./ ; fi;)
$(shell if [ ! -f ./.bowerrc ] 2>/dev/null; then cp -prv config/.bowerrc ./ ; fi;)

## ------------------------------------------------------------------------ ##
APP_NAME := cmdb-rtm
Expand Down
38 changes: 38 additions & 0 deletions src/web/assets/js/app/io-client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* web/assets/js/app/io-client.js */

$(function () {

let ioClient = io()
, aSpds = ['total', 'fast', 'norm', 'slow']
, entries = aSpds.map((x) => { return [[`${x}`], 0] })
, P = '[ioClient]'
;

window.aStats = Object.fromEntries(entries);

console.log(`${P} window.aStats (${typeof window.aStats}):`, window.aStats);
console.log(`${P} (${typeof ioClient}):`, ioClient);
// console.log(`[ioClient] entries (${typeof entries}):`, entries);

ioClient.on('connect', function () {
console.info(`${P} Connected to ioServer as: [${ioClient.id}]`);
$('#client-id').text( ioClient.id );
});

ioClient.on('disconnect', function () {
console.log(`${P} Disconnected from ioServer!`);
});

ioClient.on('message', function (job) {
// console.log(`[ioClient] RECV: message for [joId:${job.id}]:`, job);
$('#template').progressBar(job);
});

ioClient.on('progress', function (job) {
console.log(`${P} RECV progress for [JOB:${job.id}]`);
$('#template').progressBar(job);
});

ioClient.connect();

});

0 comments on commit 1140325

Please sign in to comment.