remove redundancies

pull/3475/head
Joseph Izang 2 years ago committed by Aniket
parent 7146254d3a
commit affa294efb
  1. 1
      apps/docviewer/src/app/App.tsx
  2. 17
      apps/docviewer/src/app/docviewer.ts

@ -7,7 +7,6 @@ export default function App() {
const [contents, setContents] = useState('') const [contents, setContents] = useState('')
useEffect(() => { useEffect(() => {
client.eventEmitter.on('contentsReady', (fileContents: string) => { client.eventEmitter.on('contentsReady', (fileContents: string) => {
console.log('contentsReady', fileContents)
setContents(fileContents) setContents(fileContents)
}) })

@ -4,7 +4,6 @@ import EventEmitter from 'events'
export class DocViewer extends PluginClient { export class DocViewer extends PluginClient {
mdFile: string mdFile: string
fileContents: string
eventEmitter: EventEmitter eventEmitter: EventEmitter
constructor() { constructor() {
super() super()
@ -15,25 +14,9 @@ export class DocViewer extends PluginClient {
this.onload() this.onload()
} }
async setProperties() {
console.log('inside setProperties')
this.on('docgen' as any, 'docsGenerated', async (docs: string[]) => {
console.log('docsGenerated', docs)
this.mdFile = docs[0]
const contents = await this.call('fileManager', 'readFile', this.mdFile)
console.log({ contents })
this.fileContents = contents
this.eventEmitter.emit('docviewer', 'contentsReady', this.fileContents)
})
}
async viewDocs(docs: string[]) { async viewDocs(docs: string[]) {
console.log('viewDocs', docs)
console.log('docsGenerated', docs)
this.mdFile = docs[0] this.mdFile = docs[0]
const contents = await this.call('fileManager', 'readFile', this.mdFile) const contents = await this.call('fileManager', 'readFile', this.mdFile)
console.log({ contents })
this.fileContents = contents
this.eventEmitter.emit('contentsReady', contents) this.eventEmitter.emit('contentsReady', contents)
} }
} }
Loading…
Cancel
Save