@talend/react-cmf
Version:
A framework built on top of best react libraries
25 lines (24 loc) • 789 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.waitFor = waitFor;
var _effects = require("redux-saga/effects");
var _selectors = _interopRequireDefault(require("../selectors"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* this saga ends when the collection is available
* @param {string} id of the collection to wait for
* @param {number} interval in ms
*/
function* waitFor(id, interval = 10) {
// eslint-disable-next-line no-constant-condition
while (true) {
const collection = yield (0, _effects.select)(_selectors.default.collections.get, id);
if (collection !== undefined) {
break;
}
yield (0, _effects.delay)(interval);
}
}
//# sourceMappingURL=collection.js.map