Wait for scripts defined in common xmodule code to execute.

STUD-1792
Merge pull request #4119 from edx/christina/requirejs-promise

Wait for scripts defined in common xmodule code to execute.