Skip to content

Commit 85f2993

Browse files
committed
onReady
1 parent b033519 commit 85f2993

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

lib/optimizely/index.ts

+13-18
Original file line numberDiff line numberDiff line change
@@ -1285,27 +1285,22 @@ export default class Optimizely extends BaseService implements Client {
12851285

12861286
/**
12871287
* Returns a Promise that fulfills when this instance is ready to use (meaning
1288-
* it has a valid datafile), or has failed to become ready within a period of
1288+
* it has a valid datafile), or rejects when it has failed to become ready within a period of
12891289
* time (configurable by the timeout property of the options argument), or when
1290-
* this instance is closed via the close method.
1290+
* this instance is closed via the close method before it became ready.
12911291
*
1292-
* If a valid datafile was provided in the constructor, the returned Promise is
1293-
* immediately fulfilled. If an sdkKey was provided, a manager will be used to
1294-
* fetch a datafile, and the returned promise will fulfill if that fetch
1295-
* succeeds or fails before the timeout. The default timeout is 30 seconds,
1296-
* which will be used if no timeout is provided in the argument options object.
1292+
* If a static project config manager with a valid datafile was provided in the constructor,
1293+
* the returned Promise is immediately fulfilled. If a polling config manager was provided,
1294+
* it will be used to fetch a datafile, and the returned promise will fulfill if that fetch
1295+
* succeeds, or it will reject if the datafile fetch does not complete before the timeout.
1296+
* The default timeout is 30 seconds.
12971297
*
1298-
* The returned Promise is fulfilled with a result object containing these
1299-
* properties:
1300-
* - success (boolean): True if this instance is ready to use with a valid
1301-
* datafile, or false if this instance failed to become
1302-
* ready or was closed prior to becoming ready.
1303-
* - reason (string=): If success is false, this is a string property with
1304-
* an explanatory message. Failure could be due to
1305-
* expiration of the timeout, network errors,
1306-
* unsuccessful responses, datafile parse errors,
1307-
* datafile validation errors, or the instance being
1308-
* closed
1298+
* The returned Promise is fulfilled with an unknown result which is not needed to
1299+
* be inspect to know that the instance is ready. If the promise is fulfilled, it
1300+
* is guaranteed that the instance is ready to use. If the promise is rejected, it
1301+
* means the instance is not ready to use, and the reason for the promise rejection
1302+
* will contain an error denoting the cause of failure.
1303+
13091304
* @param {Object=} options
13101305
* @param {number|undefined} options.timeout
13111306
* @return {Promise}

0 commit comments

Comments
 (0)