-1

I am using a JSOM SharePoint call to get some values from a list. Once I get the values in the callback I want to execute the code in the main method of the thread. How do I do that?

spdev
  • 361
  • 3
  • 9

1 Answers1

0

It is javascript, callbacks execute in the main thread.

I suspect that's not your actual issue and you are having some problems with the async nature of the call and/or closures. If so, please extend your question to provide more information on your exact problem.

Paul-Jan
  • 16,746
  • 1
  • 63
  • 95
  • I am trying to update the UI on the callback, render some checkboxes, is this possible? Or is there some way in which I have to switch to the main thread? – spdev Feb 26 '16 at 21:48
  • Yes, this is a very common scenario. There is no "main thread", javascript asynchronicity is not multithread based. Everything happens in the same thread (disregarding web workers & co for the moment). – Paul-Jan Feb 27 '16 at 20:02