gd-sprest 9.4.8 → 9.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,12 +3,9 @@
3
3
  * @param callback The method to execute when the process is working.
4
4
  * @param interval The sleep time in milliseconds to wait before calling the callback method
5
5
  */
6
- export const WebWorker: IWebWorker;
6
+ export const WebWorker: (callback: () => void, interval: number) => IWebWorker;
7
7
 
8
8
  export interface IWebWorker {
9
- // Constructor
10
- (callback: () => void, interval: number): IWebWorker;
11
-
12
9
  // Stops the worker process
13
10
  stop: () => void;
14
11
 
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebWorker = void 0;
3
+ exports.WebWorker = WebWorker;
4
4
  // Web Worker
5
- var WebWorker = /** @class */ (function () {
5
+ var _WebWorker = /** @class */ (function () {
6
6
  // Constructor
7
- function WebWorker(callback, interval) {
7
+ function _WebWorker(callback, interval) {
8
8
  if (interval === void 0) { interval = 1000; }
9
9
  var _this = this;
10
10
  this._worker = null;
@@ -24,12 +24,15 @@ var WebWorker = /** @class */ (function () {
24
24
  });
25
25
  }
26
26
  // Starts the loop
27
- WebWorker.prototype.start = function () { this._worker.postMessage("start"); };
27
+ _WebWorker.prototype.start = function () { this._worker.postMessage("start"); };
28
28
  // Stops the loop
29
- WebWorker.prototype.stop = function () { this._worker.postMessage("stop"); };
30
- return WebWorker;
29
+ _WebWorker.prototype.stop = function () { this._worker.postMessage("stop"); };
30
+ return _WebWorker;
31
31
  }());
32
- exports.WebWorker = WebWorker;
32
+ function WebWorker(callback, interval) {
33
+ if (interval === void 0) { interval = 1000; }
34
+ return new _WebWorker(callback, interval);
35
+ }
33
36
  // The worker code
34
37
  function WorkerCode(interval) {
35
38
  return "\nlet interval = [Default Interval];\nlet loopId = null;\nself.onmessage = (e) => {\n // See if the input is a number\n if (typeof (e.data) === \"number\") {\n // Set the interval value\n interval = e.data;\n }\n\n // See if we are stopping the loop\n if (e.data == \"stop\") {\n // Stop the interval and loop id\n clearInterval(loopId);\n loopId = null;\n return;\n }\n\n // See if we are starting the loop\n if (e.data == \"start\") {\n // Ensure it's not already started\n if (loopId != null) { return; }\n\n // Start the loop\n loopId = setInterval(() => {\n // Trigger the callback\n self.postMessage(null);\n }, interval || 1000);\n }\n}".replace('[Default Interval]', interval.toString());
@@ -810,7 +810,7 @@ var _ContextInfo = /** @class */ (function () {
810
810
  });
811
811
  };
812
812
  // Create the process
813
- this._worker = new webWorker_1.WebWorker(function () {
813
+ this._worker = (0, webWorker_1.WebWorker)(function () {
814
814
  // Refresh the REST API token
815
815
  refreshREST();
816
816
  // Refresh the Graph API token
package/build/rest.js CHANGED
@@ -9,7 +9,7 @@ var sptypes_1 = require("./sptypes");
9
9
  * SharePoint REST Library
10
10
  */
11
11
  exports.$REST = {
12
- __ver: 9.48,
12
+ __ver: 9.49,
13
13
  AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
14
14
  Apps: Lib.Apps,
15
15
  ContextInfo: Lib.ContextInfo,
@@ -6995,12 +6995,9 @@ declare module 'gd-sprest/helper/methods/webWorker' {
6995
6995
  * @param callback The method to execute when the process is working.
6996
6996
  * @param interval The sleep time in milliseconds to wait before calling the callback method
6997
6997
  */
6998
- export const WebWorker: IWebWorker;
6998
+ export const WebWorker: (callback: () => void, interval: number) => IWebWorker;
6999
6999
 
7000
7000
  export interface IWebWorker {
7001
- // Constructor
7002
- (callback: () => void, interval: number): IWebWorker;
7003
-
7004
7001
  // Stops the worker process
7005
7002
  stop: () => void;
7006
7003