262.js 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. R"====(
  6. var $262 = {
  7. createRealm: function () {
  8. return WScript.LoadScript('', 'samethread').$262;
  9. },
  10. global: this,
  11. agent: {
  12. start: function (src) {
  13. WScript.LoadScript(
  14. `
  15. $262 = {
  16. agent:{
  17. receiveBroadcast: function(callback){ WScript.ReceiveBroadcast(callback); },
  18. report: function(value){ WScript.Report(value); },
  19. leaving: function(){ WScript.Leaving(); }
  20. }
  21. };
  22. ${src}
  23. `, 'crossthread');
  24. },
  25. broadcast: function (sab) { WScript.Broadcast(sab); },
  26. sleep: function (timeout) { WScript.Sleep(timeout); },
  27. getReport: function () { return WScript.GetReport(); },
  28. },
  29. };
  30. )===="