UNPKG

olympus-r

Version:

一个力求简单易用的前端开发框架 #### 开发语言 TypeScript #### 核心架构 MVC #### 模块间通讯和解耦 采用事件机制,利用一个全局唯一的事件派发器进行模块间通讯,解耦模块间依赖 #### 表现层结构 使用桥接模式拆分接口与实现,达到一套核心驱动多套表现层的目的(目前支持DOM、Egret、PixiJS三种表现层),同时支持表现层的未来可扩展性 #### TypeScript装饰器注入 框架提供TypeScript装饰器注入功能,便捷获取托管对象。例如:

104 lines (103 loc) 2.83 kB
/** * @author Raykid * @email initial_r@qq.com * @create date 2018-03-20 * @modify date 2018-03-20 * * 外壳接口 */ export default interface IShell { /** * 获取当前外壳类型 * * @readonly * @type {string} * @memberof IShell */ readonly type: string; /*************************** 下面是页面跳转接口 ***************************/ /** * 刷新页面 * * @param {{ * forcedReload?:boolean, // false表示允许从缓存取,true表示强制从服务器取,默认是false * url?:string, // 传递则使用新URL刷新页面 * replace?:boolean // 如果有新url,则表示是否要替换当前浏览历史 * }} [params] * @memberof IShell */ reload(params?: { forcedReload?: boolean; url?: string; replace?: boolean; }): void; /** * 打开一个新页面 * * @param {{ * url?:string, // 新页面地址,不传则不更新地址 * name?:string, // 给新页面命名,或导航到已有页面 * replace?:boolean, // 是否替换当前浏览历史条目,默认false * features:{[key:string]:any} // 其他可能的参数 * }} [params] * @memberof IShell */ open(params?: { url?: string; name?: string; replace?: boolean; features: { [key: string]: any; }; }): void; /** * 关闭窗口 * * @memberof IShell */ close(params?: { [key: string]: any; }): void; /*************************** 下面是本地存储接口 ***************************/ /** * 获取本地存储 * * @param {string} key 要获取值的键 * @returns {string} 获取的值 * @memberof IShell */ localStorageGet(key: string): string; /** * 设置本地存储 * * @param {string} key 要设置的键 * @param {string} value 要设置的值 * @memberof IShell */ localStorageSet(key: string, value: string): void; /** * 移除本地存储 * * @param {string} key 要移除的键 * @memberof IShell */ localStorageRemove(key: string): void; /** * 清空本地存储 * * @memberof IShell */ localStorageClear(): void; /** 此项代表外壳接口可根据实际情况扩展基类没有的方法或属性 */ [name: string]: any; } export interface IShellProxyConstructor { new (): IShell; /** * 是否命中该类型外壳 * * @type {boolean} * @memberof IShellProxyConstructor */ readonly hit: boolean; }