
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
@jacobtipp/replay-bloc
Advanced tools
A package that provides mixins which adds automatic undo and redo support and cubit states. Built to work with `@jacobtipp/bloc`.
A package that provides mixins which adds automatic undo and redo support and cubit states. Built to work with @jacobtipp/bloc.
npm install @jacobtipp/replay-bloc
ReplayCubitimport { Cubit } from "@jacobtipp/bloc"
import { WithReplayCubit } from "@jacobtipp/replay-bloc"
//
// Create a base cubit that extends from Cubit
class CounterCubitBase extends Cubit<number> {}
// Wrap your Cubit with WithReplayCubit mixin
class CounterCubit extends WithReplayCubit(CounterCubitBase) {
increment = () => this.emit(this.state + 1);
}
ReplayCubitfunction main() {
const cubit = new CounterCubit(0);
// trigger a state change
cubit.increment();
console.log(cubit.state); // 1
// undo a change
cubit.undo();
console.log(cubit.state); // 0
// redo the change
cubit.redo();
console.log(cubit.state) // 1
}
If you wish to be able to use a WithReplayCubit in conjuction with a different type of mixin like WithHydratedCubit, you can compose multiple mixins together.
import { Cubit } from "@jacobtipp/bloc"
import { WithReplayCubit } from "@jacobtipp/replay-bloc"
import { WithHydratedCubit } from "@jacobtipp/hydrated-bloc"
// Create a base cubit that extends from Cubit
class CounterCubitBase extends Cubit<number> {}
const ReplayAndHydrated = WithHydratedCubit(WithReplayCubit(CounterCubitBase))
class CounterCubit extends ReplayAndHydrated {
constructor(count: number) {
super(count)
this.hydrate()
}
increment = () => this.emit(this.state + 1)
undoIncrement = () => this.undo()
}
ReplayBlocimport { Bloc } from "@jacobtipp/bloc"
import { WithReplayBloc } from "@jacobtipp/replay-bloc"
// events
abstract class CounterEvent extends ReplayEvent {}
class Increment extends CounterEvent {}
// Create a base bloc that extends from Bloc
class CounterBlocBase extends Bloc<CounterEvent, number> {}
// Wrap your Bloc with WithReplayBloc mixin
class CounterBloc extends WithReplayBloc(CounterBlocBase) {
constructor(count: number) {
super(count)
this.on(Increment, (event, emit) => emit(this.state + 1))
}
}
ReplayBlocfunction main() {
const bloc = new CounterBloc(0);
// trigger a state change
bloc.add(new Increment())
await delay(1000) // wait for event to be handled
console.log(bloc.state); // 1
// undo a change
bloc.undo();
console.log(bloc.state); // 0
// redo the change
bloc.redo();
console.log(bloc.state) // 1
}
If you wish to be able to use a WithReplayBloc in conjuction with a different type of mixin like WithHydratedBloc, you can compose multiple mixins together.
// events
import { Bloc } from "@jacobtipp/bloc"
import { WithReplayBloc } from "@jacobtipp/replay-bloc"
import { WithHydratedBloc } from "@jacobtipp/hydrated-bloc"
abstract class CounterEvent extends ReplayEvent {}
class Increment extends CounterEvent {}
// Create a base bloc that extends from Bloc
class CounterBlocBase extends Bloc<CounterEvent, number> {}
const ReplayAndHydrated = WithHydratedBloc(WithReplayBloc(CounterBlocBase))
class CounterBloc extends ReplayAndHydrated {
constructor(count: number) {
super(count)
this.hydrate()
}
undoIncrement = () => this.undo()
}
FAQs
A package that provides mixins which adds automatic undo and redo support and cubit states. Built to work with `@jacobtipp/bloc`.
We found that @jacobtipp/replay-bloc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.