I have the following code.
fileA.js:
import Sprite from './fileB.js';
const context = canvas.getContext('2d');
fileB.js:
class Sprite{
...
draw(){
context.drawImage{
...}
...}
}
export default Sprite
I import class Sprite from fileB to fileA. But the class Sprite from fileB need a variable declared in fileA resulting in a circular dependency. Even though I found this article I'm not sure how to solve this issue.
How can I solve this circular dependency?
Via Active questions tagged javascript - Stack Overflow https://ift.tt/brOl3CT
Comments
Post a Comment