refactoring and cleanup

pull/5370/head
Joseph Izang 2 years ago
parent 0fd795082e
commit 979fa62e82
  1. 10
      apps/remixdocgen/src/app/App.tsx
  2. 5
      apps/remixdocgen/src/app/docgen-client.ts

@ -21,7 +21,6 @@ export const getNewContractNames = (compilationResult: CompilationResult) => {
}
const App = () => {
const [themeType, setThemeType] = useState<string>('dark');
const [hasBuild, setHasBuild] = useState<boolean>(false);
const [fileName, setFileName] = useState<string>('');
@ -39,12 +38,9 @@ const App = () => {
client.eventEmitter.on('docsGenerated', (docs: string[]) => {
console.log('docsGenerated', docs)
})
};
watchThemeSwitch();
}, []);
}
watchThemeSwitch()
}, [])
return (
<div>

@ -16,9 +16,8 @@ export class DocGenClient extends PluginClient {
constructor() {
super()
this.eventEmitter = new EventEmitter()
this.methods = ['generateDocs', 'viewDocs']
createClient(this)
// this.docgen = new DocGen()
this.methods = ['generateDocs', 'publishDocs', 'viewDocs']
this.onload().then(async () => {
console.log('docgen client loaded')
await this.setListeners()
@ -28,7 +27,7 @@ export class DocGenClient extends PluginClient {
async setListeners() {
this.currentTheme = await this.call('theme', 'currentTheme')
this.on("theme", "themeChanged", (theme: any) => {
this.on('theme', 'themeChanged', (theme: any) => {
this.currentTheme = theme
this.eventEmitter.emit('themeChanged', this.currentTheme)
});

Loading…
Cancel
Save