In context I have two javascript files, one handles the actual page itself while another handles a popup tutorial. Each script file is nested within a function as shown below:
(function () {
'use strict';
// script here
}());
In the main script is the following function:
function updateCompView(ident) {
'use script';
// code is here
}
However what I'm finding is that if I reference this function within the second script file (for the tutorial) like so:
updateCompView('KL-COM-001');
I get an Uncaught ReferenceError. I have managed to resolve this by removing the top-level function however this then means I get a large number of 'use strict' JSLint errors.
Is there a way to reference functions that are nested within an external function?
if (!window.myNamespace) window.myNamespace = {}then setwindow.myNamespace.updateCompView = updateCompView;and now you can access it aswindow.myNamespace.updateCompViewfrom outside