Skip to content

Commit 5e64300

Browse files
(added) added new action onHover which takes data from the frontend all the way to the backend
1 parent 449d9ca commit 5e64300

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

src/app/reducers/mainReducer.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ export default (state, action) => produce(state, draft => {
3939
};
4040

4141
switch (action.type) {
42+
case types.ON_HOVER: {
43+
console.log(currentTab);
44+
console.log('onHover Firedin side of the reducer');
45+
port.postMessage({
46+
action: 'onHover',
47+
payload: 'payload from Reducer ON_HOVER',
48+
tabId: currentTab,
49+
})
50+
break;
51+
}
52+
4253
case types.MOVE_BACKWARD: {
4354
if (snapshots.length > 0 && sliderIndex > 0) {
4455
const newIndex = sliderIndex - 1;

src/backend/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,9 @@ function getRouteURL(node: SnapshotNode): string {
4545
// * Event listener for time-travel actions
4646
window.addEventListener('message', ({ data: { action, payload } }: MsgData) => {
4747
switch (action) {
48-
49-
5048
case 'jumpToSnap':
5149
// console.log('action:', action);
52-
// console.log('payload', payload);
50+
console.log('payload', payload);
5351
// console.log('payload.name:', payload.name)
5452
// console.log(test)
5553
timeJump(payload, true); // * This sets state with given payload
@@ -66,7 +64,7 @@ window.addEventListener('message', ({ data: { action, payload } }: MsgData) => {
6664
mode.paused = payload;
6765
break;
6866
case 'onHover':
69-
console.log('WE MADE IT ALL THE WAY FROM THE FRONTEND! HERE\'S THE PAYLOAD:');
67+
console.log('WE MADE IT ALL THE WAY FROM THE FRONTEND! HERE\'S THE PAYLOAD:', payload);
7068
break;
7169
default:
7270
break;

src/extension/contentScript.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ chrome.runtime.onMessage.addListener(request => { // seems to never fire
3838
break;
3939
case 'onHover':
4040
//wtf does this do??
41+
console.log('onHover fired inside of ContentScripts');
4142
window.postMessage(request, '*');
4243
default:
4344
break;

0 commit comments

Comments
 (0)