{"version":3,"sources":["../../../packages/core/test-utilities/wait-async.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBxG","file":"wait-async.d.ts","sourcesContent":["/**\r\n * Waits for an asynchronous condition to be achieved.\r\n * NOTE: This legacy utility is not a good replacement for proper angular techniques\r\n *\r\n * @param condition The function to determine if the desired state was achieved.\r\n * @param errorMessage The message to fail the Jasmine test case with.\r\n * @param duration The duration in milliseconds (ms) to wait for the desired condition.\r\n */\r\nexport function waitAsync(condition: () => boolean, errorMessage: string, duration = 1000): Promise<void> {\r\n    const timeLimit = Date.now() + duration;\r\n    return new Promise(\r\n        (resolve, reject) => {\r\n            const interval = setInterval(\r\n                () => {\r\n                    if (condition()) {\r\n                        clearInterval(interval);\r\n                        resolve();\r\n                        return;\r\n                    }\r\n\r\n                    if (Date.now() >= timeLimit) {\r\n                        clearInterval(interval);\r\n                        reject(errorMessage);\r\n                        fail(errorMessage);\r\n                        return;\r\n                    }\r\n                },\r\n                10);\r\n        });\r\n}\r\n"]}