@patternplate/client
Version:
Universal javascript client application for patternplate
47 lines (39 loc) • 894 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.type = exports.default = void 0;
var _default = scrollDemo;
exports.default = _default;
const type = "SCROLL_DEMO";
exports.type = type;
let loop;
let frame;
function scrollDemo(payload) {
return (dispatch, getState) => {
function run() {
loop = global.requestAnimationFrame(() => {
const state = getState();
if (state.scrollDemoX.x !== frame.x) {
dispatch({
type: "SCROLL_DEMO_X",
payload: frame.x
});
}
if (state.scrollDemoY.y !== frame.y) {
dispatch({
type: "SCROLL_DEMO_Y",
payload: frame.y
});
}
run();
});
}
if (!loop) {
run();
}
frame = payload;
};
}
scrollDemo.type = type;
//# sourceMappingURL=scroll-demo.js.map