pull/3542/head
filip mertens 2 years ago committed by Joseph Izang
parent b4274624fc
commit ed1db5d547
  1. 2
      apps/remixdocgen/src/app/App.tsx
  2. 16
      apps/remixdocgen/src/app/docgen-client.ts

@ -40,6 +40,7 @@ const App = () => {
console.log('docsGenerated', docs)
})
};
watchThemeSwitch();
@ -50,6 +51,7 @@ const App = () => {
<h1>Remix Docgen</h1>
{fileName && <h2>File: {fileName}</h2>}
{hasBuild && <button onClick={() => client.generateDocs()}>Generate doc</button>}
{hasBuild && <button onClick={() => client.opendDocs()}>Open docs</button>}
</div>
)
};

@ -18,7 +18,7 @@ export class DocGenClient extends PluginClient {
this.eventEmitter = new EventEmitter()
createClient(this)
// this.docgen = new DocGen()
this.methods = ['generateDocs', 'publishDocs']
this.methods = ['generateDocs', 'publishDocs', 'viewDocs']
this.onload().then(async () => {
console.log('docgen client loaded')
await this.setListeners()
@ -26,7 +26,8 @@ export class DocGenClient extends PluginClient {
}
async setListeners() {
this.currentTheme = await this.call('theme', 'currentTheme');
this.currentTheme = await this.call('theme', 'currentTheme')
this.on("theme", "themeChanged", (theme: any) => {
this.currentTheme = theme
this.eventEmitter.emit('themeChanged', this.currentTheme)
@ -64,6 +65,17 @@ export class DocGenClient extends PluginClient {
this.eventEmitter.emit('docsGenerated', docs)
}
async opendDocs() {
console.log('docgen client openDocs')
await this.call('manager', 'activatePlugin', 'docgenviewer')
await this.call('tabs' as any, 'focus', 'docgenviewer')
await this.call('docgenviewer' as any, 'viewDocs')
}
async viewDocs(docs: string[]) {
console.log('docgen client viewDocs')
}
async generateDocs() {
console.log('docgen client generateDocs')
this.docgen([this.build])

Loading…
Cancel
Save