callbackClear.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. //
  6. //In theory this test could be race-y -- in which case suppress the console printing but in general ch should be well behaved
  7. //
  8. telemetryLog("Start Global Code", true);
  9. var foo1id = undefined;
  10. function foo1()
  11. {
  12. telemetryLog("Start Foo1", true);
  13. WScript.Echo("Hello World - CallBack 1");
  14. telemetryLog("End Foo1", true);
  15. }
  16. function foo2()
  17. {
  18. telemetryLog("Start Foo2", true);
  19. WScript.Echo("Cancel Callback 1 from CallBack 2");
  20. WScript.ClearTimeout(foo1id);
  21. telemetryLog("End Foo2", true);
  22. emitTTDLog(ttdLogURI);
  23. }
  24. foo1id = WScript.SetTimeout(foo1, 500);
  25. WScript.SetTimeout(foo2, 100);
  26. WScript.Echo("Hello World - Global");
  27. telemetryLog("End Global Code", true);