MCPcopy Index your code
hub / github.com/rapi-doc/RapiDoc / onSpecFileChange

Method onSpecFileChange

src/rapidoc.js:664–679  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

662 }
663
664 onSpecFileChange(e) {
665 this.setAttribute('spec-file', this.shadowRoot.getElementById('spec-file').value);
666 const specFile = e.target.files[0];
667 const reader = new FileReader();
668 reader.onload = () => {
669 try {
670 const specObj = JSON.parse(reader.result);
671 this.loadSpec(specObj);
672 this.shadowRoot.getElementById('spec-url').value = '';
673 } catch {
674 console.error('RapiDoc: Unable to read or parse json'); // eslint-disable-line no-console
675 }
676 };
677 // Read the Text file
678 reader.readAsText(specFile);
679 }
680
681 onFileLoadClick() {
682 this.shadowRoot.getElementById('spec-file').click();

Callers

nothing calls this directly

Calls 2

loadSpecMethod · 0.95
parseMethod · 0.45

Tested by

no test coverage detected