UNPKG

@kloudsoftware/eisen

Version:

Declarative and expressive TypeScript framework for building modern web applications

38 lines (37 loc) 1.46 kB
import { VApp } from './vdom/VApp'; import { Component } from './vdom/Component'; import { Attribute, VNode } from './vdom/VNode'; import { Props } from './vdom/Props'; declare type ComponentPropsHolder = [Component, Props]; export interface IRouter { resolveRoute(path: string): Promise<boolean>; registerRoute(path: string, component: Component, props?: Props): void; hasRouteRegistered(path: string): boolean; useMiddleWare(middleWare: MiddleWare): void; } export interface MiddleWare { check(path: string): Promise<boolean>; } export declare class Router implements IRouter { private app; private resolvedRouterMap; componentMap: Map<string, ComponentPropsHolder>; private mount; private currPath; private middleWares; private pathVariables; constructor(app: VApp, mount: VNode); useMiddleWare(middleWare: MiddleWare): void; registerRoute(path: string, component: Component, props?: Props): void; hasRouteRegistered(path: string): boolean; private findMatchingPath; resolveRoute(path: string): Promise<boolean>; } export declare const isRouterLink: (node: VNode) => boolean; export declare class RouterLink extends VNode { target: string; isRouterLink: boolean; constructor(app: VApp, target: string, children: VNode[], innerHtml?: string, props?: Props, attrs?: Attribute[], parent?: VNode, id?: string); clickFunction(event: Event, link: VNode): void; } export {};