Skip to content

Commit 85391f1

Browse files
committed
remove let and const declarations
1 parent 96253f6 commit 85391f1

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

sysend.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@
100100
if (typeof url === 'string' && host(url) !== window.location.host) {
101101
domains = domains || [];
102102
domains.push(origin(url));
103-
const iframe = document.createElement('iframe');
103+
var iframe = document.createElement('iframe');
104104
iframe.style.width = iframe.style.height = 0;
105105
iframe.style.position = 'absolute';
106106
iframe.style.top = iframe.style.left = '-9999px';
107107
iframe.style.border = 'none';
108-
let proxy_url = url;
108+
var proxy_url = url;
109109
if (!url.match(/\.html|\.php|\?/)) {
110110
proxy_url = url.replace(/\/$/, '') + '/proxy.html';
111111
}
@@ -117,7 +117,7 @@
117117
iframe.removeEventListener('error', handler);
118118
});
119119
iframe.addEventListener('load', function handler() {
120-
let win;
120+
var win;
121121
// fix for Safari
122122
// https://stackoverflow.com/q/42632188/387194
123123
try {
@@ -193,11 +193,11 @@
193193
});
194194
},
195195
list: function() {
196-
const id = list_id++;
197-
const marker = { target: target_id, id: id };
198-
const timer = delay(sysend.timeout);
196+
var id = list_id++;
197+
var marker = { target: target_id, id: id, origin: self.origin };
198+
var timer = delay(sysend.timeout);
199199
return new Promise(function(resolve) {
200-
const ids = [];
200+
var ids = [];
201201
sysend.on(make_internal('__window_ack__'), function(data) {
202202
log('__window_ack__', { data, marker });
203203
if (data.origin.target === target_id && data.origin.id === id) {
@@ -229,17 +229,17 @@
229229
}
230230
},
231231
rpc: function(object) {
232-
const prefix = ++rpc_count;
233-
const req = `__${prefix}_rpc_request__`;
234-
const res = `__${prefix}_rpc_response__`;
235-
let request_index = 0;
236-
const timeout = 1000;
232+
var prefix = ++rpc_count;
233+
var req = `__${prefix}_rpc_request__`;
234+
var res = `__${prefix}_rpc_response__`;
235+
var request_index = 0;
236+
var timeout = 1000;
237237
function request(id, method, args = []) {
238-
const req_id = ++request_index;
238+
var req_id = ++request_index;
239239
return new Promise((resolve, reject) => {
240240
sysend.track('message', function handler({data, origin}) {
241241
if (data.type === res) {
242-
const { result, error, id: res_id } = data;
242+
var { result, error, id: res_id } = data;
243243
if (origin === id && req_id === res_id) {
244244
if (error) {
245245
reject(error);
@@ -252,16 +252,16 @@
252252
}
253253
}, true);
254254
sysend.post(id, { method, id: req_id, type: req, args });
255-
const timer = setTimeout(() => {
255+
var timer = setTimeout(() => {
256256
reject(new Error('Timeout error'));
257257
}, timeout);
258258
});
259259
}
260260

261261
sysend.track('message', async function handler({ data, origin }) {
262262
if (data.type == req) {
263-
const { method, args, id } = data;
264-
const type = res;
263+
var { method, args, id } = data;
264+
var type = res;
265265
if (Object.hasOwn(object, method)) {
266266
try {
267267
unpromise(object[method](...args), function(result) {
@@ -278,7 +278,7 @@
278278
}
279279
}
280280
}, true);
281-
const error_msg = 'You need to specify the target window/tab';
281+
var error_msg = 'You need to specify the target window/tab';
282282
return Object.fromEntries(Object.keys(object).map(name => {
283283
return [name, (id, ...args) => {
284284
if (!id) {
@@ -329,7 +329,7 @@
329329
// -------------------------------------------------------------------------
330330
function unpromise(obj, callback, error = null) {
331331
if (is_promise(obj)) {
332-
const ret = obj.then(callback);
332+
var ret = obj.then(callback);
333333
if (error === null) {
334334
return ret;
335335
} else {
@@ -644,7 +644,7 @@
644644
}
645645
// -------------------------------------------------------------------------
646646
function setup_update_tracking() {
647-
let list = [];
647+
var list = [];
648648

649649
function update() {
650650
trigger(handlers.update, list);

0 commit comments

Comments
 (0)