MCPcopy Index your code
hub / github.com/massCodeIO/massCode / bindEvents

Function bindEvents

integrations/clipper/src/popup.ts:74–118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72}
73
74function bindEvents(): void {
75 targetButtons.forEach((button) => {
76 button.addEventListener('click', () => {
77 const target = button.dataset.target
78 if (!isCaptureTarget(target)) {
79 return
80 }
81
82 activeTarget = target
83 settings.defaultTarget = activeTarget
84 updateTargetButtons()
85 updateCaptureName()
86 updatePreview()
87 void persistDefaultTarget()
88 })
89 })
90
91 captureNameInput?.addEventListener('input', () => {
92 isCaptureNameEdited = true
93 })
94
95 toggleSettingsButton?.addEventListener('click', () => {
96 updateSettingsPanel(settingsPanel?.hidden ?? true)
97 })
98
99 saveSettingsButton?.addEventListener('click', () => {
100 void persistSettings()
101 })
102
103 captureButton?.addEventListener('click', () => {
104 void captureCurrentPayload()
105 })
106
107 document.addEventListener('keydown', (event) => {
108 if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {
109 event.preventDefault()
110 void captureCurrentPayload()
111 return
112 }
113
114 if (event.key === 'Escape') {
115 window.close()
116 }
117 })
118}
119
120async function persistSettings(): Promise<void> {
121 settings = readSettingsFromForm()

Callers 1

initFunction · 0.85

Calls 8

isCaptureTargetFunction · 0.90
updateTargetButtonsFunction · 0.85
updateCaptureNameFunction · 0.85
updatePreviewFunction · 0.85
persistDefaultTargetFunction · 0.85
updateSettingsPanelFunction · 0.85
persistSettingsFunction · 0.85
captureCurrentPayloadFunction · 0.85

Tested by

no test coverage detected