flush-effects.js 749 B

12345678910111213141516171819
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.useFlushEffects = useFlushEffects;
  6. exports.FlushEffectsContext = void 0;
  7. var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
  8. var _react = _interop_require_wildcard(require("react"));
  9. const FlushEffectsContext = /*#__PURE__*/ _react.default.createContext(null);
  10. exports.FlushEffectsContext = FlushEffectsContext;
  11. function useFlushEffects(callback) {
  12. const addFlushEffects = (0, _react).useContext(FlushEffectsContext);
  13. // Should have no effects on client where there's no flush effects provider
  14. if (addFlushEffects) {
  15. addFlushEffects(callback);
  16. }
  17. }
  18. //# sourceMappingURL=flush-effects.js.map