import { CxPlatform } from "../../mooc/chaoxing/platform" ; import { ZhsPlatform } from "../../mooc/zhihuishu/platform" ; import { Course163Platform } from "../../mooc/course163/platform" ; import { IEventListener } from "@App/internal/utils/event" ; import { Task } from "@App/internal/app/task" ; export type MoocEvent = "complete" | "reload" | "error" | "taskComplete" ; export interface Mooc { Init ( ) : any ; } export interface MoocTaskSet extends Mooc , IEventListener < MoocEvent > { Init ( ) : Promise < any > ; Stop ( ) : Promise < any > ; Next ( ) : Promise < Task > ; SetTaskPointer ( index ) : void ; } export interface MoocFactory { CreateMooc ( ) : Mooc ; } export class DefaultMoocFactory implements MoocFactory { public CreateMooc ( ) { let mooc = new CxPlatform ( ) . CreateMooc ( ) ; if ( mooc == null ) { mooc = new ZhsPlatform ( ) . CreateMooc ( ) ; } if ( mooc == null ) { mooc = new Course163Platform ( ) . CreateMooc ( ) ; } return mooc ; } }