MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / onSaveToFile

Method onSaveToFile

static/widgets/load-save.ts:276–293  ·  view source on GitHub ↗
(fileEditor?: string)

Source from the content-addressed store, hash-verified

274 }
275
276 onSaveToFile(fileEditor?: string) {
277 try {
278 const fileLang = this.currentLanguage?.name ?? '';
279 const name = fileLang && fileEditor !== undefined ? fileLang + ' Editor #' + fileEditor + ' ' : '';
280 saveAs(
281 new Blob([this.editorText], {type: 'text/plain;charset=utf-8'}),
282 'Compiler Explorer ' + name + 'Code' + this.extension,
283 );
284 return true;
285 } catch {
286 this.alertSystem.notify('Error while saving your code. Use the clipboard instead.', {
287 group: 'savelocalerror',
288 alertClass: 'notification-error',
289 dismissTime: 5000,
290 });
291 return false;
292 }
293 }
294}

Callers 2

initializeIfNeededMethod · 0.95
handleCtrlSMethod · 0.80

Calls 1

notifyMethod · 0.80

Tested by

no test coverage detected