@microsoft/teams-js 2.0.0-beta.3-dev.11 → 2.0.0-beta.3-dev.12
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.
package/dist/MicrosoftTeams.d.ts
CHANGED
|
@@ -2717,7 +2717,7 @@ export namespace app {
|
|
|
2717
2717
|
*
|
|
2718
2718
|
* @param validMessageOrigins - Optionally specify a list of cross frame message origins. They must have
|
|
2719
2719
|
* https: protocol otherwise they will be ignored. Example: https:www.example.com
|
|
2720
|
-
* @returns Promise that will be fulfilled when initialization has completed
|
|
2720
|
+
* @returns Promise that will be fulfilled when initialization has completed, or rejected if the initialization fails or times out
|
|
2721
2721
|
*/
|
|
2722
2722
|
function initialize(validMessageOrigins?: string[]): Promise<void>;
|
|
2723
2723
|
/**
|
package/dist/MicrosoftTeams.js
CHANGED
|
@@ -395,7 +395,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
395
395
|
});
|
|
396
396
|
|
|
397
397
|
;// CONCATENATED MODULE: ./src/internal/constants.ts
|
|
398
|
-
var version = '2.0.0-beta.3-dev.
|
|
398
|
+
var version = '2.0.0-beta.3-dev.12';
|
|
399
399
|
/**
|
|
400
400
|
* @hidden
|
|
401
401
|
* The SDK version when all SDK APIs started to check platform compatibility for the APIs was 1.6.0.
|
|
@@ -780,6 +780,31 @@ function callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(funcHelp
|
|
|
780
780
|
});
|
|
781
781
|
return p;
|
|
782
782
|
}
|
|
783
|
+
/**
|
|
784
|
+
* A helper function to add a timeout to an asynchronous operation.
|
|
785
|
+
*
|
|
786
|
+
* @param action Action to wrap the timeout around
|
|
787
|
+
* @param timeoutInMs Timeout period in milliseconds
|
|
788
|
+
* @param timeoutError Error to reject the promise with if timeout elapses before the action completed
|
|
789
|
+
* @returns A promise which resolves to the result of provided action or rejects with a provided timeout error
|
|
790
|
+
* if the initial action didn't complete within provided timeout.
|
|
791
|
+
*
|
|
792
|
+
* @internal
|
|
793
|
+
*/
|
|
794
|
+
function runWithTimeout(action, timeoutInMs, timeoutError) {
|
|
795
|
+
return new Promise(function (resolve, reject) {
|
|
796
|
+
var timeoutHandle = setTimeout(reject, timeoutInMs, timeoutError);
|
|
797
|
+
action()
|
|
798
|
+
.then(function (result) {
|
|
799
|
+
clearTimeout(timeoutHandle);
|
|
800
|
+
resolve(result);
|
|
801
|
+
})
|
|
802
|
+
.catch(function (error) {
|
|
803
|
+
clearTimeout(timeoutHandle);
|
|
804
|
+
reject(error);
|
|
805
|
+
});
|
|
806
|
+
});
|
|
807
|
+
}
|
|
783
808
|
function createTeamsAppLink(params) {
|
|
784
809
|
var url = new URL('https://teams.microsoft.com/l/entity/' +
|
|
785
810
|
encodeURIComponent(params.appId) +
|
|
@@ -1808,6 +1833,10 @@ var app_app;
|
|
|
1808
1833
|
return GlobalVars.frameContext;
|
|
1809
1834
|
}
|
|
1810
1835
|
app.getFrameContext = getFrameContext;
|
|
1836
|
+
/**
|
|
1837
|
+
* Number of milliseconds we'll give the initialization call to return before timing it out
|
|
1838
|
+
*/
|
|
1839
|
+
var initializationTimeoutInMs = 5000;
|
|
1811
1840
|
/**
|
|
1812
1841
|
* Initializes the library.
|
|
1813
1842
|
*
|
|
@@ -1817,9 +1846,13 @@ var app_app;
|
|
|
1817
1846
|
*
|
|
1818
1847
|
* @param validMessageOrigins - Optionally specify a list of cross frame message origins. They must have
|
|
1819
1848
|
* https: protocol otherwise they will be ignored. Example: https:www.example.com
|
|
1820
|
-
* @returns Promise that will be fulfilled when initialization has completed
|
|
1849
|
+
* @returns Promise that will be fulfilled when initialization has completed, or rejected if the initialization fails or times out
|
|
1821
1850
|
*/
|
|
1822
1851
|
function initialize(validMessageOrigins) {
|
|
1852
|
+
return runWithTimeout(function () { return initializeHelper(validMessageOrigins); }, initializationTimeoutInMs, new Error('SDK initialization timed out.'));
|
|
1853
|
+
}
|
|
1854
|
+
app.initialize = initialize;
|
|
1855
|
+
function initializeHelper(validMessageOrigins) {
|
|
1823
1856
|
return new Promise(function (resolve) {
|
|
1824
1857
|
// Independent components might not know whether the SDK is initialized so might call it to be safe.
|
|
1825
1858
|
// Just no-op if that happens to make it easier to use.
|
|
@@ -1884,7 +1917,6 @@ var app_app;
|
|
|
1884
1917
|
resolve(GlobalVars.initializePromise);
|
|
1885
1918
|
});
|
|
1886
1919
|
}
|
|
1887
|
-
app.initialize = initialize;
|
|
1888
1920
|
/**
|
|
1889
1921
|
* @hidden
|
|
1890
1922
|
* Hide from docs.
|