@metamask/snaps-simulation
Version:
A simulation framework for MetaMask Snaps, enabling headless testing of Snaps in a controlled environment
29 lines • 928 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTrackEventImplementation = void 0;
const effects_1 = require("redux-saga/effects");
const store_1 = require("../../store/index.cjs");
/**
* Track an event.
*
* @param event - The event to track.
* @returns `null`.
* @yields Adds the event to the store.
*/
function* trackEventImplementation(event) {
yield (0, effects_1.put)((0, store_1.trackEvent)(event));
return null;
}
/**
* Get a method that can be used to track an event.
*
* @param runSaga - A function to run a saga outside the usual Redux flow.
* @returns A method that can be used to track an event.
*/
function getTrackEventImplementation(runSaga) {
return (...args) => {
return runSaga(trackEventImplementation, ...args).result();
};
}
exports.getTrackEventImplementation = getTrackEventImplementation;
//# sourceMappingURL=track-event.cjs.map