Search code examples
javascriptnode.jsecmascript-6callbackrollup

ES6 NPM RollUp.Js failing Callbacks


Using NodeJS for RollUp.js. When I try to create a callback function, like so, I get "Uncaught TypeError: e is not a function", what am I doing wrong?

main.js

import { intro } from './modules/intro.js';
import { CallWhenReady } from './modules/_checker.js';

// Run Application
window.onload = function () {
    CallWhenReady(intro);
};

_checker.js

export function CallWhenReady(callback)
{
   callback();
}

intro.js

export function intro()
{
   console.log('Intro has started.');
}

Solution

  • Oh I actually found the issue!

    My passed argument, the function in my belief, was rendered undefined. This was because I had another file affecting my code that ran the same callback function over and over, not passing the argument again.