-
-
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 22f322d
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 renderType = 'auto' | 'desktop' | 'mobile' | 'specific' | ||
type renderName = 'VisualEditor' | 'WikimediaDesktop' | 'WikimediaMobile' | ||
|
||
interface RendererBuilderOptionsBase { | ||
renderType: renderType | ||
} | ||
|
||
interface RendererBuilderOptionsCommon { | ||
renderType: renderType | ||
renderName?: never | ||
} | ||
|
||
interface RendererBuilderOptionsSpecific extends RendererBuilderOptionsBase { | ||
renderType: 'specific' | ||
renderName: renderName | ||
} | ||
|
||
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