cyra
Version:
single page application view engine
97 lines (96 loc) • 2.27 kB
TypeScript
import { Route } from './model/Route';
import { Page } from './model/Page';
export interface SplitObject {
start: string;
key: string;
item: string;
}
export interface AppStorageItem {
key: string;
default: string;
}
export interface AppStorageObject {
destinationMethods: AppStorageItem;
appStorage: AppStorageItem;
}
export interface CyraConfigType {
APP_ROOT: string;
URL_DATA_LIMIT: number;
URL_DATA_SPLIT: SplitObject;
DEFAULT_ROOT: string;
DOM_PREFIX: string;
ALWAYS_RELOAD: boolean;
ENTER_SEQ: Array<string>;
ENTER_BASIC_SEQ: Array<string>;
LEAVE_SEQ: Array<string>;
LEAVE_BASIC_SEQ: Array<string>;
PARAM_PREFIX: string;
APPSTORAGE: AppStorageObject;
COPYINDEX: string;
SWITCH_DURATION: number;
ANIMATION: boolean;
ANIMATION_PREFIX: string;
ANIMATION_FUNC: string;
}
export interface ModelsObject {
pages: {
[key: string]: {
pageClass: new (path: string) => Page;
instances: Array<Page>;
};
};
routes: Array<Route>;
}
export interface SenquenceFunction {
(next: Function): void;
}
export interface InitAppObject {
index: string;
routes: RouteData;
mode?: string;
appRoot?: string;
paramPrefix?: string;
root?: string;
alwaysReload?: boolean;
dataSplit?: {
start: string;
key: string;
item: string;
};
copyIndex?: string;
animation?: boolean;
animationPrefix?: string;
animationFunc?: string;
switchDuration?: number;
}
export interface InitPathObject {
routing: Function;
}
export interface UrlObject {
path: string;
title?: string;
data: any;
copyIndex?: number;
pageIndex?: number;
}
export interface RouteData {
[index: string]: new (pageID?: string) => Page;
}
export interface ContextType {
rootContainer: HTMLElement;
data: any;
useSwitch: boolean;
currentRoute: Route;
currentPage: Page;
currentContainer: HTMLElement;
previousPage: Page;
}
export interface PathHandlerType {
routing: Function;
updatePath: (urlObject: UrlObject, isShadow: boolean) => void;
start: () => void;
}
export interface DestinationMethod {
funcName: string;
args: any;
}