webfast 0.1.58 → 0.1.59
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/app/content/js/webfast.js +32 -1
- package/package.json +1 -1
@@ -124,11 +124,42 @@ web.fast.connectWebSocket = function(socketURL,maxRetries = 40, retries = 0) {
|
|
124
124
|
console.log('WebSocket connected');
|
125
125
|
// Start other things (e.g., send initial data)
|
126
126
|
web.fast.que.state = true;
|
127
|
+
|
128
|
+
//alert(web.fast.tools.isMobile);
|
129
|
+
function arraySend() {
|
130
|
+
try {
|
131
|
+
if (web.fast.user != undefined || window.Telegram.WebApp.initData == ``) {
|
132
|
+
let arraySend = [];
|
133
|
+
jQuery(`[webfast-get]`).each(async function(){
|
134
|
+
const type = jQuery(this).attr(`webfast-get`);
|
135
|
+
let id = jQuery(this).attr(`id`);
|
136
|
+
if (id == undefined) {
|
137
|
+
id = await web.fast.tools.generateRandomId(8); // Generate a random ID of length 8
|
138
|
+
}
|
139
|
+
arraySend.push({
|
140
|
+
id : id,
|
141
|
+
type : type
|
142
|
+
})
|
143
|
+
})
|
144
|
+
console.log(`Send Array`,arraySend);
|
145
|
+
web.fast.tools.on.connect(arraySend);
|
146
|
+
} else {
|
147
|
+
throw new Error(`error some send`);
|
148
|
+
}
|
149
|
+
} catch (err) {
|
150
|
+
console.error(`Try again`);
|
151
|
+
setTimeout(function(){
|
152
|
+
arraySend();
|
153
|
+
},200);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
// send array
|
157
|
+
arraySend();
|
127
158
|
|
128
159
|
};
|
129
160
|
|
130
161
|
ws.onmessage = (event) => {
|
131
|
-
console.log('Received:', event.data);
|
162
|
+
//console.log('Received:', event.data);
|
132
163
|
// Handle received data
|
133
164
|
// Check if type user then we will walk through the data to set the data for the user
|
134
165
|
const json = JSON.parse(event.data);
|