Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/content/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { LeetCodeAdapter } from '../platforms/leetcode/adapter';

console.log('[CommitCode] Content script loaded on', window.location.href);

const adapter = new LeetCodeAdapter();
adapter.startListening((problem) => {
console.log('[CommitCode] Sending problem to Sync Engine:', problem);
chrome.runtime.sendMessage({ type: 'SYNC_PROBLEM', problem });
});
Comment on lines +5 to +9
14 changes: 14 additions & 0 deletions src/platforms/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ProblemRecord } from '../storage/types';

export interface PlatformAdapter {
/**
* Initializes any listeners or mutation observers needed to detect a submission.
* Calls the provided callback when an accepted submission is detected.
*/
startListening(onSubmissionDetected: (problem: ProblemRecord) => void): void;

/**
* Cleans up any listeners.
*/
stopListening(): void;
}