-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Renderer builder, replace types and interfaces to the Abstra…
…ct renderer
- Loading branch information
1 parent
14fd7a4
commit df401b5
Showing
7 changed files
with
54 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,30 @@ | ||
import { RenderOpts } from './../../Downloader.js' | ||
type RenderMode = 'auto' | 'desktop' | 'mobile' | 'specific' | ||
type RenderAPI = 'VisualEditor' | 'WikimediaDesktop' | 'WikimediaMobile' | ||
|
||
interface RendererBuilderOptionsBase { | ||
renderMode: RenderMode | ||
} | ||
|
||
interface RendererBuilderOptionsCommon { | ||
renderMode: RenderMode | ||
renderAPI?: never | ||
} | ||
|
||
interface RendererBuilderOptionsSpecific extends RendererBuilderOptionsBase { | ||
renderMode: 'specific' | ||
renderAPI: RenderAPI | ||
} | ||
|
||
export type RendererBuilderOptions = RendererBuilderOptionsCommon | RendererBuilderOptionsSpecific | ||
|
||
export interface RenderOpts { | ||
data?: any | ||
articleId?: string | ||
articleDetailXId?: RKVS<ArticleDetail> | ||
articleDetail?: ArticleDetail | string | ||
isMainPage?: boolean | ||
} | ||
|
||
export abstract class Renderer { | ||
abstract render(renderOpts: RenderOpts): Promise<any> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters