-1

I removed my JS code in separate file and now I want to call it and execute it in the one that it was before. My new file name is blockedComponents.js. I added it in BundleConfig and I am trying to call it methods like this:

      function getBlockedComponentsMethods()
      {
             BlockedComponents.pageChangedHandler();
      }

My function in the new file is called

     function BlockedComponents();

Should I require it somehow , because now I have error that pageChangedHandler is not defined?

Sarah
  • 35
  • 1
  • 9
  • 1
    What is "BundleConfig"? What bundler are you using? – str Mar 12 '18 at 14:18
  • 1
    Check this out https://stackoverflow.com/questions/950087/how-do-i-include-a-javascript-file-in-another-javascript-file – aMJay Mar 12 '18 at 14:20
  • Does `BlockedComponents` function returns `pageChangedHandler` function? What does `BlockedComponents` code looks like? – palaѕн Mar 12 '18 at 14:20

1 Answers1

1

Sorry, I didn't get what are you trying to do here, but in general :

If you would like to call a static method like this :

BlockedComponents.pageChangedHandler();

You should do something like the following :

function BlockedComponents() {
//Code here ...
}

BlockedComponents.pageChangedHandler = function() {
//Code here ...
};
CryptoBird
  • 508
  • 1
  • 5
  • 22