PDA

View Full Version : Got error "io is not defined" because socket.io.js conflicts with jspdf



jaselg
10 Jan 2016, 10:20 PM
I'm using jsPDF (https://github.com/MrRio/jsPDF) for PDF document creation in a Sencha ExtJS6 project. When I was trying to inspect the app using Sencha Inspector 6.0.1.250, the inspector was failed to be connected to since the script could not go through the function:


f = function() {
if (AI.socket = io(b),
AI.socket.on("ai_request", g),
AI.socket.on("reconnect", function() {
SenchaInspector.getAppDetails(!0)
}),
...
}

and the error "io is not defined" would be thrown every time the function was visited.

My investigation showed that there are conflicts between Sencha's socket.io.js and the jsPDF over loading required scripts. If I removed the jsPDF from loading along with my app, Sencha Inspector can be connected successfully with errors.

Tested version:
jsPDF: 1.1.239-git Built on 2015-08-26T20:20
Sencha Inspector: 6.0.1.250
Sencha: ExtJS 6.0.1

mitchellsimoens
12 Jan 2016, 5:21 AM
I guess I fail to see why jspdf would inhibit socket.io from loading?

sbachman
27 Jun 2016, 3:15 PM
I have a similar reporting tool integrated. I get the same error when trying to use inspector. If I disable the reporting engine, then inspector works. I would rather not disable the reporting engine.