I have a function defined inside in HTML which is of module type.I need to call that function from another js file included in that same HTML file. When I call a function from a js file, it is referred to as reference error.
This is what I have in my HTML file :
<script src="../src/viewer.js"></script>
<script type="module" src="../pravintest/player.js"></script>
In viewer.js file I have a code where I call a function crossdatacheck(param) which is in player.js.
This is my player.js file:
import * as THREE from './threejs/build/three.module.js';
import { GUI } from './threejs/examples/jsm/libs/dat.gui.module.js';
import { OrbitControls } from './threejs/examples/jsm/controls/OrbitControls.js';
import { NRRDLoader } from './threejs/examples/jsm/loaders/NRRDLoader.js';
import { VolumeRenderShader1 } from './threejs/examples/jsm/shaders/VolumeShader.js';
import { WEBGL } from './threejs/examples/jsm/WebGL.js';
var renderer,
scene,
camera,
controls,
material,
volconfig,
cmtextures;
function crossdatacheck(data) {
console.log(data);
}
I want to call this function from the viewer.js file.
When I call a function from viewer.js there is an error -> reference error: crossdatacheck function is not defined in viewer.js Can anyone suggests to me how can I do this?