MCPcopy
hub / github.com/wellsjo/JSON-Splora / constructor

Method constructor

app/js/Editor.js:64–84  ·  view source on GitHub ↗

* Creates the input editor, sets a welcome message, and registers DOM events * * @param {Element} el The textarea element to use for CodeMirror instance * @param {jQuery} filter The filter input element

(el, filter)

Source from the content-addressed store, hash-verified

62 */
63
64 constructor(el, filter) {
65 super()
66
67 // Create CodeMirror input and filter elements
68 this.editor = CodeMirror.fromTextArea(el, defaultEditorOptions)
69 this.filter = filter
70
71 // Path to store data file so it can be read for jq (required for large input)
72 // NOTE: the absolute path is too long to be parsed by jq in Windows
73 if (process.platform === 'win32') {
74 this.tmp = path.join('app', 'tmp', 'data.json')
75 } else {
76 this.tmp = path.resolve(__dirname, '..', 'tmp', 'data.json')
77 }
78
79 // Set js-beautify format options
80 this.formatOptions = defaultFormatOptions
81
82 // Handle functions that respond to input
83 this.handleEvents()
84 }
85
86 /**
87 * Respond to editor and filter input

Callers

nothing calls this directly

Calls 1

handleEventsMethod · 0.95

Tested by

no test coverage detected