I am getting error
Uncaught SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
when the following js is added to the html head,
;
;frappe.socket = {
open_tasks: {},
open_docs: [],
emit_queue: [],
...
doc_open: function(doctype, docname) {
"use strict";
if (!frappe.socket.last_doc || (frappe.socket.last_doc[0] != doctype && frappe.socket.last_doc[0] != docname)) {
frappe.socket.socket.emit('doc_open', doctype, docname);
}
frappe.socket.last_doc = [doctype, docname];
},
...
}
Note I added "use strict"; based on existing stackoverflow threads. I am still getting the error. The chrome debugger points at the below line.
frappe.socket.last_doc = [doctype, docname];
The browser is a cordova app, running in Android Studio Emulator. I think it is using InAppBrowser. The remaining js fails to load after this error. I am not sure which code needs strict mode.
The same code runs fine without "use strict" in chrome, Edge, FF.
Found the issue: Even though the Google Chrome Developer Window was showing this line, This line was the first statement in the minified JS line.
On looking at the complete Minified JS line, I found the issue is in another line later,
frappe.socket.file_watcher.on('reload_css', function(filename) {
let abs_file_path = "assets/" + filename;
Adding "use strict at the start of this function fixed the issue. –