MCPcopy Create free account
hub / github.com/ampproject/amphtml / wrapWait

Function wrapWait

build-system/tasks/e2e/controller-promise.js:79–84  ·  view source on GitHub ↗

* Wrap the given wait function with the given mutation function, * while still allowing it to be mutated again in the future by * the inner opt_mutate function. * @param {function(CONDITION, function(VALUE): ?DERIVED): Promise } wait * @param {function(VALUE): MUTANT} mutate * @return {func

(wait, mutate)

Source from the content-addressed store, hash-verified

77 * @template RES
78 */
79function wrapWait(wait, mutate) {
80 return (condition, opt_mutate) => {
81 opt_mutate = opt_mutate || ((x) => /** @type {*} */ (x));
82 return wait(condition, (value) => opt_mutate(mutate(value)));
83 };
84}
85
86module.exports = {
87 ControllerPromise,

Callers 1

thenMethod · 0.85

Calls 1

mutateFunction · 0.50

Tested by

no test coverage detected