Skip to content

Instantly share code, notes, and snippets.

@metehus
Created September 7, 2021 00:11
Show Gist options
  • Save metehus/219ae1c4efcdbb5358ff3ec056f688ff to your computer and use it in GitHub Desktop.
Save metehus/219ae1c4efcdbb5358ff3ec056f688ff to your computer and use it in GitHub Desktop.
// import { Plugin, PrestionProject, Slide } from ".";
class PrestionProject {
public config: PrestionProjectConfig
public slides: Slide<this>[]
constructor(config: PrestionProjectConfigOptionals = {}) {
this.config = config as PrestionProjectConfig
this.slides = this.config.slides.map(Slide => new Slide(this))
}
}
class Slide<P extends PrestionProject> {
public engine: P
constructor(engine: P) {
this.engine = engine
}
}
export interface SlideConstructor {
new (engine: PrestionProject): Slide<PrestionProject>;
}
export interface PrestionProjectConfig {
name: string,
slides: SlideConstructor[],
// plugins: Plugin<PrestionProject>[],
element: string | HTMLElement,
}
export interface PrestionProjectConfigOptionals {
name?: string,
slides?: SlideConstructor[],
// plugins?: Plugin<PrestionProject>[],
element?: string | HTMLElement,
}
class CustomPrestionProject extends PrestionProject {
public teste(a: string) {
}
}
class BomDia extends Slide<CustomPrestionProject> {
start () {
this.engine.teste("a")
}
}
const prestion = new CustomPrestionProject({
slides: [
BomDia
]
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment