0

I have page with 5 webparts all executed using CSOM and JSOM code . All webparts maintain their own js and css files . I am facing issues with the CSOM code , the code it behaves unexpectedly sometimes the code doesnt trigger , it execute twice sometimes . I suspect the issue is with the way the page is loaded with the javascripts . Any suggestions on how to make the page load only once or best practises for CSOM ? Also to mention i get spcontext is undefined error sometimes .

1

Without code there is only guessing. You write your web parts have all own js files, but this does not mean they have not a single global scope. Maybe this is a timing problem with some variables used in different js files.

Try to use immediately-invoked function expression (IIFE) to get local scopes of your variables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.