webfast 0.1.58 → 0.1.59

Sign up to get free protection for your applications and to get access to all the features.
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webfast",
3
- "version": "0.1.58",
3
+ "version": "0.1.59",
4
4
  "description": "WebFast! Bot Application, including TON mini-apps for makign it easy and fast to build ini-apps",
5
5
  "main": "index.js",
6
6
  "repository": {