type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ClassDeclaration
class ResourceManagerError extends Error { static errorMessage: { 1001: string; 1002: string; 1005: string; 2001: string; 2002: string; 2003: string; 2004: string; 2005: string; 2006: string; }; /** * why instanceof e != ResourceManagerError ??? * see link : https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work */ private __resource_manager_error__; constructor(code: number, replacer?: Object, replacer2?: Object); }
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
ClassDeclaration
class NewFileSystem { private data; constructor(data: Dictionary); profile(): void; addFile(filename: string, type?: string): void; getFile(filename: string): File | null; private reslove(dirpath); private mkdir(dirpath); private exists(dirpath); }
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
ClassDeclaration
/** * The events of resource loading. * @version Egret 2.4 * @platform Web,Native * @language en_US */ /** * 资源加载事件。 * @version Egret 2.4 * @platform Web,Native * @language zh_CN */ class ResourceEvent extends egret.Event { /** * Failure event for a load item. * @version Egret 2.4 * @platform Web,Native * @language en_US */ /** * 一个加载项加载失败事件。 * @version Egret 2.4 * @platform Web,Native * @language zh_CN */ static ITEM_LOAD_ERROR: string; /** * Configure file to load and parse the completion event. Note: if a configuration file is loaded, it will not be thrown out, and if you want to handle the configuration loading failure, monitor the CONFIG_LOAD_ERROR event. * @version Egret 2.4 * @platform Web,Native * @language en_US */ /** * 配置文件加载并解析完成事件。注意:若有配置文件加载失败,将不会抛出此事件,若要处理配置加载失败,请同时监听 CONFIG_LOAD_ERROR 事件。 * @version Egret 2.4 * @platform Web,Native * @language zh_CN */ static CONFIG_COMPLETE: string; /** * Configuration file failed to load. * @version Egret 2.4 * @platform Web,Native * @language en_US */ /** * 配置文件加载失败事件。 * @version Egret 2.4 * @platform Web,Native * @language zh_CN */ static CONFIG_LOAD_ERROR: string; /** * Delay load group resource loading progress event. * @version Egret 2.4 * @platform Web,Native * @language en_US */ /** * 延迟加载组资源加载进度事件。 * @version Egret 2.4 * @platform Web,Native * @language zh_CN */ static GROUP_PROGRESS: string; /** * Delay load group resource to complete event. Note: if you have a resource item loading failure, the event will not be thrown, if you want to handle the group load failure, please listen to the GROUP_LOAD_ERROR event. * @version Egret 2.4 * @platform Web,Native * @language en_US */ /** * 延迟加载组资源加载完成事件。注意:若组内有资源项加载失败,将不会抛出此事件,若要处理组加载失败,请同时监听 GROUP_LOAD_ERROR 事件。 * @version Egret 2.4 * @platform Web,Native * @language zh_CN */ static GROUP_COMPLETE: string; /** * Delayed load group resource failed event. * @version Egret 2.4 * @platform Web,Native * @language en_US */ /** * 延迟加载组资源加载失败事件。 * @version Egret 2.4 * @platform Web,Native * @language zh_CN */ static GROUP_LOAD_ERROR: string; /** * Creates an Event object to pass as a parameter to event listeners. * @param type The type of the event, accessible as Event.type. * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false. * @param cancelable Determines whether the Event object can be canceled. The default values is false. * @version Egret 2.4 * @platform Web,Native * @private * @language en_US */ /** * 创建一个作为参数传递给事件侦听器的 Event 对象。 * @param type 事件的类型,可以作为 Event.type 访问。 * @param bubbles 确定 Event 对象是否参与事件流的冒泡阶段。默认值为 false。 * @param cancelable 确定是否可以取消 Event 对象。默认值为 false。 * @version Egret 2.4 * @platform Web,Native * @private * @language zh_CN */ constructor(type: string, bubbles?: boolean, cancelable?: boolean); /** * File number that has been loaded. * @version Egret 2.4 * @platform Web,Native * @language en_US */ /** * 已经加载的文件数。 * @version Egret 2.4 * @platform Web,Native * @language zh_CN */ itemsLoaded: number; /** * Total file number to load. * @version Egret 2.4 * @platform Web,Native * @language en_US */ /** * 要加载的总文件数。 * @version Egret 2.4 * @platform Web,Native * @language zh_CN */ itemsTotal: number; /** * Resource group name. * @version Egret 2.4 * @platform Web,Native * @language en_US */ /** * 资源组名。 * @version Egret 2.4 * @platform Web,Native * @language zh_CN */ groupName: string; /** * An item of information that is finished by the end of a load. * @version Egret 2.4 * @platform Web,Native * @language en_US */ /** * 一次加载项加载结束的项信息对象。 * @version Egret 2.4 * @platform Web,Native * @language zh_CN */ resItem: ResourceItem; }
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
ClassDeclaration
/** * @private */ class Resource extends egret.EventDispatcher { /** * 开始加载配置 * @method RES.loadConfig */ loadConfig(): Promise<void>; /** * 检查某个资源组是否已经加载完成 * @method RES.isGroupLoaded * @param name {string} */ isGroupLoaded(name: string): boolean; /** * 根据组名获取组加载项列表 * @method RES.getGroupByName * @param name {string} */ getGroupByName(name: string): Array<ResourceInfo>; /** * 根据组名加载一组资源 * @method RES.loadGroup * @param name {string} * @param priority {number} */ loadGroup(name: string, priority?: number, reporter?: PromiseTaskReporter): Promise<any>; private _loadGroup(name, priority?, reporter?); loadResources(keys: string[], reporter?: PromiseTaskReporter): Promise<any>; /** * 创建自定义的加载资源组,注意:此方法仅在资源配置文件加载完成后执行才有效。 * 可以监听ResourceEvent.CONFIG_COMPLETE事件来确认配置加载完成。 * @method RES.ResourceConfig#createGroup * @param name {string} 要创建的加载资源组的组名 * @param keys {egret.Array<string>} 要包含的键名列表,key对应配置文件里的name属性或一个资源组名。 * @param override {boolean} 是否覆盖已经存在的同名资源组,默认false。 * @returns {boolean} */ createGroup(name: string, keys: Array<string>, override?: boolean): boolean; /** * 检查配置文件里是否含有指定的资源 * @method RES.hasRes * @param key {string} 对应配置文件里的name属性或subKeys属性的一项。 * @returns {boolean} */ hasRes(key: string): boolean; /** * 通过key同步获取资源 * @method RES.getRes * @param key {string} * @returns {any} */ getRes(resKey: string): any; /** * 通过key异步获取资源 * @method RES.getResAsync * @param key {string} * @param compFunc {Function} 回调函数。示例:compFunc(data,url):void。 * @param thisObject {any} */ getResAsync(key: string): Promise<any>; getResAsync(key: string, compFunc: GetResAsyncCallback, thisObject: any): void; /** * 通过url获取资源 * @method RES.getResByUrl * @param url {string} * @param compFunc {Function} * @param thisObject {any} * @param type {string} */ getResByUrl(url: string, compFunc: Function, thisObject: any, type?: string): Promise<any> | void; /** * 销毁单个资源文件或一组资源的缓存数据,返回是否删除成功。 * @method RES.destroyRes * @param name {string} 配置文件中加载项的name属性或资源组名 * @param force {boolean} 销毁一个资源组时其他资源组有同样资源情况资源是否会被删除,默认值true * @returns {boolean} */ destroyRes(name: string, force?: boolean): Promise<boolean>; /** * 设置最大并发加载线程数量,默认值是2. * @method RES.setMaxLoadingThread * @param thread {number} 要设置的并发加载数。 */ setMaxLoadingThread(thread: number): void; /** * 设置资源加载失败时的重试次数。 * @param retry 要设置的重试次数。 */ setMaxRetryTimes(retry: number): void; addResourceData(data: { name: string; type: string; url: string; }): void; }
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
InterfaceDeclaration
interface ResourceInfo { url: string; type: string; root: string; crc32?: string; size?: number; name: string; soundType?: string; scale9grid?: string; groupNames?: string[]; promise?: Promise<any>; }
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
InterfaceDeclaration
interface Data { resourceRoot: string; typeSelector: ResourceTypeSelector; mergeSelector: ResourceMergerSelector | null; fileSystem: FileSystem; groups: { [groupName: string]: string[]; }; alias: { [aliasName: string]: string; }; }
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
InterfaceDeclaration
interface ProcessHost { state: { [index: string]: number; }; resourceConfig: ResourceConfig; load: (resource: ResourceInfo, processor?: string | processor.Processor) => Promise<any>; unload: (resource: ResourceInfo) => Promise<any>; save: (rexource: ResourceInfo, data: any) => void; get: (resource: ResourceInfo) => any; remove: (resource: ResourceInfo) => void; }
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
InterfaceDeclaration
/** * Promise的回调函数集合 */ interface PromiseTaskReporter { /** * 进度回调 */ onProgress?: (current: number, total: number) => void; /** * 取消回调 */ onCancel?: () => void; }
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
InterfaceDeclaration
interface Processor { onLoadStart(host: ProcessHost, resource: ResourceInfo): Promise<any>; onRemoveStart(host: ProcessHost, resource: ResourceInfo): Promise<any>; getData?(host: ProcessHost, resource: ResourceInfo, key: string, subkey: string): any; }
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
InterfaceDeclaration
interface File { url: string; type: string; name: string; root: string; }
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
InterfaceDeclaration
interface Dictionary { [file: string]: File | Dictionary; }
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
InterfaceDeclaration
interface FileSystem { addFile(filename: string, type?: string, root?: string): any; getFile(filename: string): File | null; profile(): void; }
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
InterfaceDeclaration
interface ResourceItem extends ResourceInfo { /** * Name of resource term. * @version Egret 2.4 * @platform Web,Native * @language en_US */ /** * 加载项名称。 * @version Egret 2.4 * @platform Web,Native * @language zh_CN */ name: string; /** * URL of resource term. * @version Egret 2.4 * @platform Web,Native * @language en_US */ /** * 要加载的文件地址。 * @version Egret 2.4 * @platform Web,Native * @language zh_CN */ url: string; /** * Type of resource term. * @version Egret 2.4 * @platform Web,Native * @language en_US */ /** * 加载项文件类型。 * @version Egret 2.4 * @platform Web,Native * @language zh_CN */ type: string; /** * The raw data object to be referenced. * @version Egret 2.4 * @platform Web,Native * @language en_US */ /** * 被引用的原始数据对象。 * @version Egret 2.4 * @platform Web,Native * @language zh_CN */ data: ResourceInfo; crc32?: string; size?: number; soundType?: string; }
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
TypeAliasDeclaration
declare type ResourceRootSelector<T extends string> = () => T;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
TypeAliasDeclaration
declare type ResourceTypeSelector = (file: string) => string;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
TypeAliasDeclaration
declare type ResourceNameSelector = (file: string) => string;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
TypeAliasDeclaration
declare type ResourceMergerSelector = (file: string) => { path: string; alias: string; };
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
TypeAliasDeclaration
type GetResAsyncCallback = (value?: any, key?: string) => any;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
init(): Promise<void>;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
__temp__get__type__via__url(url_or_alias: string): string;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
getKeyByAlias(aliasName: string): string;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 创建自定义的加载资源组,注意:此方法仅在资源配置文件加载完成后执行才有效。 * 可以监听ResourceEvent.CONFIG_COMPLETE事件来确认配置加载完成。 * @method RES.ResourceConfig#createGroup * @param name {string} 要创建的加载资源组的组名 * @param keys {egret.Array<string>} 要包含的键名列表,key对应配置文件里的name属性或sbuKeys属性的一项或一个资源组名。 * @param override {boolean} 是否覆盖已经存在的同名资源组,默认false。 * @returns {boolean} */ createGroup(name: string, keys: Array<string>, override?: boolean): boolean;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 添加一个二级键名到配置列表。 * @method RES.ResourceConfig#addSubkey * @param subkey {string} 要添加的二级键名 * @param name {string} 二级键名所属的资源name属性 */ addSubkey(subkey: string, name: string): void;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
addAlias(alias: any, key: any): void;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 获取加载项类型。 * @method RES.ResourceConfig#getType * @param key {string} 对应配置文件里的name属性或sbuKeys属性的一项。 * @returns {string} */ getType(key: string): string;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
addResourceData(data: { name: string; type?: string; url: string; root?: string; }): void;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
destory(): void;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
load(list: ResourceInfo[], groupName: string, priority: number, reporter?: PromiseTaskReporter): Promise<any>;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
private next();
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 从优先级队列中移除指定的组名 */ private removeGroupName(groupName);
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 获取下一个待加载项 */ private getOneResourceInfo();
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
loadResource(r: ResourceInfo, p?: RES.processor.Processor): Promise<any>;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
unloadResource(r: ResourceInfo): Promise<any>;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
profile(): void;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
addFile(filename: string, type?: string): void;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
getFile(filename: string): File | null;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
private reslove(dirpath);
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
private mkdir(dirpath);
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
private exists(dirpath);
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 开始加载配置 * @method RES.loadConfig */ loadConfig(): Promise<void>;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 检查某个资源组是否已经加载完成 * @method RES.isGroupLoaded * @param name {string} */ isGroupLoaded(name: string): boolean;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 根据组名获取组加载项列表 * @method RES.getGroupByName * @param name {string} */ getGroupByName(name: string): Array<ResourceInfo>;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 根据组名加载一组资源 * @method RES.loadGroup * @param name {string} * @param priority {number} */ loadGroup(name: string, priority?: number, reporter?: PromiseTaskReporter): Promise<any>;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
private _loadGroup(name, priority?, reporter?);
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
loadResources(keys: string[], reporter?: PromiseTaskReporter): Promise<any>;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 创建自定义的加载资源组,注意:此方法仅在资源配置文件加载完成后执行才有效。 * 可以监听ResourceEvent.CONFIG_COMPLETE事件来确认配置加载完成。 * @method RES.ResourceConfig#createGroup * @param name {string} 要创建的加载资源组的组名 * @param keys {egret.Array<string>} 要包含的键名列表,key对应配置文件里的name属性或一个资源组名。 * @param override {boolean} 是否覆盖已经存在的同名资源组,默认false。 * @returns {boolean} */ createGroup(name: string, keys: Array<string>, override?: boolean): boolean;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 检查配置文件里是否含有指定的资源 * @method RES.hasRes * @param key {string} 对应配置文件里的name属性或subKeys属性的一项。 * @returns {boolean} */ hasRes(key: string): boolean;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 通过key同步获取资源 * @method RES.getRes * @param key {string} * @returns {any} */ getRes(resKey: string): any;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 通过key异步获取资源 * @method RES.getResAsync * @param key {string} * @param compFunc {Function} 回调函数。示例:compFunc(data,url):void。 * @param thisObject {any} */ getResAsync(key: string): Promise<any>;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
getResAsync(key: string, compFunc: GetResAsyncCallback, thisObject: any): void;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 通过url获取资源 * @method RES.getResByUrl * @param url {string} * @param compFunc {Function} * @param thisObject {any} * @param type {string} */ getResByUrl(url: string, compFunc: Function, thisObject: any, type?: string): Promise<any> | void;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 销毁单个资源文件或一组资源的缓存数据,返回是否删除成功。 * @method RES.destroyRes * @param name {string} 配置文件中加载项的name属性或资源组名 * @param force {boolean} 销毁一个资源组时其他资源组有同样资源情况资源是否会被删除,默认值true * @returns {boolean} */ destroyRes(name: string, force?: boolean): Promise<boolean>;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 设置最大并发加载线程数量,默认值是2. * @method RES.setMaxLoadingThread * @param thread {number} 要设置的并发加载数。 */ setMaxLoadingThread(thread: number): void;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
/** * 设置资源加载失败时的重试次数。 * @param retry 要设置的重试次数。 */ setMaxRetryTimes(retry: number): void;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
MethodDeclaration
addResourceData(data: { name: string; type: string; url: string; }): void;
SixiMeatballs/EgretGame
Demos/p2demo/libs/modules/assetsmanager/assetsmanager.d.ts
TypeScript
ArrowFunction
() => 'world'
dwfe/common
src/__tests__/just-object/just-object.test.ts
TypeScript
ArrowFunction
() => { test('isJustObject', () => { for (const arr of data) { for (const value of arr) { expect(isJustObject(value)).toBe(false); } } expect(isJustObject({})).toBe(true); expect(isJustObject({hello: 123})).toBe(true); }); test('isNotJustObject', () => { for (const arr of data) { for (const value of arr) { expect(isNotJustObject(value)).toBe(true); } } expect(isNotJustObject({})).toBe(false); expect(isNotJustObject({hello: 123})).toBe(false); }); }
dwfe/common
src/__tests__/just-object/just-object.test.ts
TypeScript
ArrowFunction
() => { for (const arr of data) { for (const value of arr) { expect(isJustObject(value)).toBe(false); } } expect(isJustObject({})).toBe(true); expect(isJustObject({hello: 123})).toBe(true); }
dwfe/common
src/__tests__/just-object/just-object.test.ts
TypeScript
ArrowFunction
() => { for (const arr of data) { for (const value of arr) { expect(isNotJustObject(value)).toBe(true); } } expect(isNotJustObject({})).toBe(false); expect(isNotJustObject({hello: 123})).toBe(false); }
dwfe/common
src/__tests__/just-object/just-object.test.ts
TypeScript
ArrowFunction
( baseAudioContextConstructor, createInvalidStateError, createNotSupportedError, createUnknownError, mediaElementAudioSourceNodeConstructor, mediaStreamAudioDestinationNodeConstructor, mediaStreamAudioSourceNodeConstructor, mediaStreamTrackAudioSourceNodeConstructor, nativeAudioContextConstructor ) => { return class AudioContext extends baseAudioContextConstructor<IAudioContext> implements IAudioContext { private _baseLatency: number; private _nativeAudioContext: TNativeAudioContext; private _state: null | 'suspended'; constructor(options: IAudioContextOptions = {}) { if (nativeAudioContextConstructor === null) { throw new Error('Missing the native AudioContext constructor.'); } const nativeAudioContext = new nativeAudioContextConstructor(options); // Bug #131 Safari returns null when there are four other AudioContexts running already. if (nativeAudioContext === null) { throw createUnknownError(); } // Bug #51 Only Chrome and Opera throw an error if the given latencyHint is invalid. if (!isValidLatencyHint(options.latencyHint)) { throw new TypeError( `The provided value '${options.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.` ); } // Bug #150 Only Chrome, Firefox and Opera support setting the sampleRate. if (options.sampleRate !== undefined && nativeAudioContext.sampleRate !== options.sampleRate) { throw createNotSupportedError(); } super(nativeAudioContext, 2); const { latencyHint } = options; const { sampleRate } = nativeAudioContext; // @todo The values for 'balanced', 'interactive' and 'playback' are just copied from Chrome's implementation. this._baseLatency = typeof nativeAudioContext.baseLatency === 'number' ? nativeAudioContext.baseLatency : latencyHint === 'balanced' ? 512 / sampleRate : latencyHint === 'interactive' || latencyHint === undefined ? 256 / sampleRate : latencyHint === 'playback' ? 1024 / sampleRate : /* * @todo The min (256) and max (16384) values are taken from the allowed bufferSize values of a * ScriptProcessorNode. */ (Math.max(2, Math.min(128, Math.round((latencyHint * sampleRate) / 128))) * 128) / sampleRate; this._nativeAudioContext = nativeAudioContext; this._state = null; /* * Bug #34: Chrome and Opera pretend to be running right away, but fire an onstatechange event when the state actually changes * to 'running'. */ if (nativeAudioContext.state === 'running') { this._state = 'suspended'; const revokeState = () => { if (this._state === 'suspended') { this._state = null; } nativeAudioContext.removeEventListener('statechange', revokeState); }; nativeAudioContext.addEventListener('statechange', revokeState); } } get baseLatency(): number { return this._baseLatency; } get state(): TAudioContextState { return this._state !== null ? this._state : this._nativeAudioContext.state; } public close(): Promise<void> { // Bug #35: Firefox does not throw an error if the AudioContext was closed before. if (this.state === 'closed') { return this._nativeAudioContext.close().then(() => { throw createInvalidStateError(); }); } // Bug #34: If the state was set to suspended before it should be revoked now. if (this._state === 'suspended') { this._state = null; } return this._nativeAudioContext.close(); /* * Bug #50: Deleting the AudioGraph is currently not possible anymore. * ...then(() => deleteAudioGraph(this, this._nativeAudioContext)); */ } public createMediaElementSource(mediaElement: HTMLMediaElement): IMediaElementAudioSourceNode<this> { return new mediaElementAudioSourceNodeConstructor(this, { mediaElement }); } public createMediaStreamDestination(): IMediaStreamAudioDestinationNode<this> { return new mediaStreamAudioDestinationNodeConstructor(this); } public createMediaStreamSource(mediaStream: MediaStream): IMediaStreamAudioSourceNode<this> { return new mediaStreamAudioSourceNodeConstructor(this, { mediaStream }); } public createMediaStreamTrackSource(mediaStreamTrack: MediaStreamTrack): IMediaStreamTrackAudioSourceNode<this> { return new mediaStreamTrackAudioSourceNodeConstructor(this, { mediaStreamTrack }); } public resume(): Promise<void> { if (this._state === 'suspended') { return new Promise((resolve, reject) => { const resolvePromise = () => { this._nativeAudioContext.removeEventListener('statechange', resolvePromise); if (this._nativeAudioContext.state === 'running') { resolve(); } else { this.resume().then(resolve, reject); } }; this._nativeAudioContext.addEventListener('statechange', resolvePromise); }); } return this._nativeAudioContext.resume().catch((err) => { // Bug #55: Chrome, Edge and Opera do throw an InvalidAccessError instead of an InvalidStateError. // Bug #56: Safari invokes the catch handler but without an error. if (err === undefined || err.code === 15) { throw createInvalidStateError(); } throw err; }); } public suspend(): Promise<void> { return this._nativeAudioContext.suspend().catch((err) => { // Bug #56: Safari invokes the catch handler but without an error. if (err === undefined) { throw createInvalidStateError(); } throw err; }); } }; }
chadpalmer2/the-music-machine-frontend
node_modules/standardized-audio-context/src/factories/audio-context-constructor.ts
TypeScript
ArrowFunction
() => { if (this._state === 'suspended') { this._state = null; } nativeAudioContext.removeEventListener('statechange', revokeState); }
chadpalmer2/the-music-machine-frontend
node_modules/standardized-audio-context/src/factories/audio-context-constructor.ts
TypeScript
ArrowFunction
() => { throw createInvalidStateError(); }
chadpalmer2/the-music-machine-frontend
node_modules/standardized-audio-context/src/factories/audio-context-constructor.ts
TypeScript
ArrowFunction
(resolve, reject) => { const resolvePromise = () => { this._nativeAudioContext.removeEventListener('statechange', resolvePromise); if (this._nativeAudioContext.state === 'running') { resolve(); } else { this.resume().then(resolve, reject); } }; this._nativeAudioContext.addEventListener('statechange', resolvePromise); }
chadpalmer2/the-music-machine-frontend
node_modules/standardized-audio-context/src/factories/audio-context-constructor.ts
TypeScript
ArrowFunction
() => { this._nativeAudioContext.removeEventListener('statechange', resolvePromise); if (this._nativeAudioContext.state === 'running') { resolve(); } else { this.resume().then(resolve, reject); } }
chadpalmer2/the-music-machine-frontend
node_modules/standardized-audio-context/src/factories/audio-context-constructor.ts
TypeScript
ArrowFunction
(err) => { // Bug #55: Chrome, Edge and Opera do throw an InvalidAccessError instead of an InvalidStateError. // Bug #56: Safari invokes the catch handler but without an error. if (err === undefined || err.code === 15) { throw createInvalidStateError(); } throw err; }
chadpalmer2/the-music-machine-frontend
node_modules/standardized-audio-context/src/factories/audio-context-constructor.ts
TypeScript
ArrowFunction
(err) => { // Bug #56: Safari invokes the catch handler but without an error. if (err === undefined) { throw createInvalidStateError(); } throw err; }
chadpalmer2/the-music-machine-frontend
node_modules/standardized-audio-context/src/factories/audio-context-constructor.ts
TypeScript
MethodDeclaration
public close(): Promise<void> { // Bug #35: Firefox does not throw an error if the AudioContext was closed before. if (this.state === 'closed') { return this._nativeAudioContext.close().then(() => { throw createInvalidStateError(); }); } // Bug #34: If the state was set to suspended before it should be revoked now. if (this._state === 'suspended') { this._state = null; } return this._nativeAudioContext.close(); /* * Bug #50: Deleting the AudioGraph is currently not possible anymore. * ...then(() => deleteAudioGraph(this, this._nativeAudioContext)); */ }
chadpalmer2/the-music-machine-frontend
node_modules/standardized-audio-context/src/factories/audio-context-constructor.ts
TypeScript
MethodDeclaration
public createMediaElementSource(mediaElement: HTMLMediaElement): IMediaElementAudioSourceNode<this> { return new mediaElementAudioSourceNodeConstructor(this, { mediaElement }); }
chadpalmer2/the-music-machine-frontend
node_modules/standardized-audio-context/src/factories/audio-context-constructor.ts
TypeScript
MethodDeclaration
public createMediaStreamDestination(): IMediaStreamAudioDestinationNode<this> { return new mediaStreamAudioDestinationNodeConstructor(this); }
chadpalmer2/the-music-machine-frontend
node_modules/standardized-audio-context/src/factories/audio-context-constructor.ts
TypeScript
MethodDeclaration
public createMediaStreamSource(mediaStream: MediaStream): IMediaStreamAudioSourceNode<this> { return new mediaStreamAudioSourceNodeConstructor(this, { mediaStream }); }
chadpalmer2/the-music-machine-frontend
node_modules/standardized-audio-context/src/factories/audio-context-constructor.ts
TypeScript
MethodDeclaration
public createMediaStreamTrackSource(mediaStreamTrack: MediaStreamTrack): IMediaStreamTrackAudioSourceNode<this> { return new mediaStreamTrackAudioSourceNodeConstructor(this, { mediaStreamTrack }); }
chadpalmer2/the-music-machine-frontend
node_modules/standardized-audio-context/src/factories/audio-context-constructor.ts
TypeScript
MethodDeclaration
public resume(): Promise<void> { if (this._state === 'suspended') { return new Promise((resolve, reject) => { const resolvePromise = () => { this._nativeAudioContext.removeEventListener('statechange', resolvePromise); if (this._nativeAudioContext.state === 'running') { resolve(); } else { this.resume().then(resolve, reject); } }; this._nativeAudioContext.addEventListener('statechange', resolvePromise); }); } return this._nativeAudioContext.resume().catch((err) => { // Bug #55: Chrome, Edge and Opera do throw an InvalidAccessError instead of an InvalidStateError. // Bug #56: Safari invokes the catch handler but without an error. if (err === undefined || err.code === 15) { throw createInvalidStateError(); } throw err; }); }
chadpalmer2/the-music-machine-frontend
node_modules/standardized-audio-context/src/factories/audio-context-constructor.ts
TypeScript
MethodDeclaration
public suspend(): Promise<void> { return this._nativeAudioContext.suspend().catch((err) => { // Bug #56: Safari invokes the catch handler but without an error. if (err === undefined) { throw createInvalidStateError(); } throw err; }); }
chadpalmer2/the-music-machine-frontend
node_modules/standardized-audio-context/src/factories/audio-context-constructor.ts
TypeScript
FunctionDeclaration
function setupHeatmap(component: Heatmap) { component.parameters = new BehaviorSubject<CollectionParameters|undefined>(mockParameters()); component.systemTopology = mockTopology(); component.preview = new BehaviorSubject<Interval|undefined>(undefined); component.layers = new BehaviorSubject<Array<BehaviorSubject<Layer>>>([]); component.viewport = new BehaviorSubject<Viewport>(new Viewport()); component.cpuFilter = new BehaviorSubject<string>(''); component.maxIntervalCount = new BehaviorSubject<number>(5000); component.showMigrations = new BehaviorSubject<boolean>(true); component.showSleeping = new BehaviorSubject<boolean>(true); }
Dithn/schedviz
client/app/heatmap/preview_layer_test.ts
TypeScript
FunctionDeclaration
function mockParameters(): CollectionParameters { const startTime = 1540768090000; const endTime = 1540768139000; return new CollectionParameters('foo', CPUS, startTime, endTime); }
Dithn/schedviz
client/app/heatmap/preview_layer_test.ts
TypeScript
FunctionDeclaration
function mockTopology(): SystemTopology { return new SystemTopology(CPUS); }
Dithn/schedviz
client/app/heatmap/preview_layer_test.ts
TypeScript
ArrowFunction
() => { beforeEach(waitForAsync(() => { document.body.style.width = '500px'; document.body.style.height = '500px'; TestBed .configureTestingModule({ imports: [HeatmapModule], providers: [ {provide: 'MetricsService', useClass: LocalMetricsService}, {provide: 'RenderDataService', useClass: LocalRenderDataService}, {provide: 'ShortcutService', useClass: ShortcutService}, ] }) .compileComponents(); })); it('should create', () => { const fixture = TestBed.createComponent(Heatmap); const component = fixture.componentInstance; setupHeatmap(component); fixture.detectChanges(); expect(component).toBeTruthy(); expect(component.previewGroup).toBeTruthy(); }); it('should render preview', () => { const fixture = TestBed.createComponent(Heatmap); const component = fixture.componentInstance; const parameters = mockParameters(); setupHeatmap(component); const cpus = [1, 5, 10]; component.preview.next( new Thread(parameters, 0, cpus, 'foo', 0, 0, 0, 0, 0, 0)); fixture.detectChanges(); const element = fixture.nativeElement; const previewLines = element.querySelectorAll('.cpu-preview'); expect(previewLines.length).toEqual(cpus.length); }); }
Dithn/schedviz
client/app/heatmap/preview_layer_test.ts
TypeScript
ArrowFunction
() => { document.body.style.width = '500px'; document.body.style.height = '500px'; TestBed .configureTestingModule({ imports: [HeatmapModule], providers: [ {provide: 'MetricsService', useClass: LocalMetricsService}, {provide: 'RenderDataService', useClass: LocalRenderDataService}, {provide: 'ShortcutService', useClass: ShortcutService}, ] }) .compileComponents(); }
Dithn/schedviz
client/app/heatmap/preview_layer_test.ts
TypeScript
ArrowFunction
() => { const fixture = TestBed.createComponent(Heatmap); const component = fixture.componentInstance; setupHeatmap(component); fixture.detectChanges(); expect(component).toBeTruthy(); expect(component.previewGroup).toBeTruthy(); }
Dithn/schedviz
client/app/heatmap/preview_layer_test.ts
TypeScript
ArrowFunction
() => { const fixture = TestBed.createComponent(Heatmap); const component = fixture.componentInstance; const parameters = mockParameters(); setupHeatmap(component); const cpus = [1, 5, 10]; component.preview.next( new Thread(parameters, 0, cpus, 'foo', 0, 0, 0, 0, 0, 0)); fixture.detectChanges(); const element = fixture.nativeElement; const previewLines = element.querySelectorAll('.cpu-preview'); expect(previewLines.length).toEqual(cpus.length); }
Dithn/schedviz
client/app/heatmap/preview_layer_test.ts
TypeScript
ArrowFunction
_type => TypeGraphQL.Float
ayushpandey8439/backend
graphql/generated/resolvers/outputs/LectureAvgAggregate.ts
TypeScript
ClassDeclaration
@TypeGraphQL.ObjectType({ isAbstract: true }) export class LectureAvgAggregate { @TypeGraphQL.Field(_type => TypeGraphQL.Float, { nullable: true }) id!: number | null; @TypeGraphQL.Field(_type => TypeGraphQL.Float, { nullable: true }) duration!: number | null; @TypeGraphQL.Field(_type => TypeGraphQL.Float, { nullable: true }) instructorId!: number | null; @TypeGraphQL.Field(_type => TypeGraphQL.Float, { nullable: true }) subcourseId!: number | null; }
ayushpandey8439/backend
graphql/generated/resolvers/outputs/LectureAvgAggregate.ts
TypeScript
ClassDeclaration
class BrowserWindowUndoc extends Electron.BrowserWindow { browserWindowOptions: Electron.BrowserWindowConstructorOptions }
dogancelik/atomic-tweetdeck
typings/atomic-tweetdeck/index.d.ts
TypeScript
InterfaceDeclaration
interface NewWindowExtendedEvent extends Electron.NewWindowWebContentsEvent { sender: BrowserWindowUndoc }
dogancelik/atomic-tweetdeck
typings/atomic-tweetdeck/index.d.ts
TypeScript
InterfaceDeclaration
interface ConfigNames { openBrowser: string; minToTray: string; x: string; y: string; width: string; height: string; maximized: string; hideMenu: string; }
dogancelik/atomic-tweetdeck
typings/atomic-tweetdeck/index.d.ts
TypeScript
InterfaceDeclaration
interface ConfigDefaults { openBrowser: boolean; minToTray: boolean; x: number; y: number; width: number; height: number; maximized: boolean; hideMenu: boolean; }
dogancelik/atomic-tweetdeck
typings/atomic-tweetdeck/index.d.ts
TypeScript
InterfaceDeclaration
interface Config { names: ConfigNames; defaults: ConfigDefaults; store: import("configstore"); }
dogancelik/atomic-tweetdeck
typings/atomic-tweetdeck/index.d.ts
TypeScript
TypeAliasDeclaration
type MenuTemplate = Array<(Electron.MenuItemConstructorOptions)>;
dogancelik/atomic-tweetdeck
typings/atomic-tweetdeck/index.d.ts
TypeScript
TypeAliasDeclaration
type NewWindowEventListener = (event: NewWindowExtendedEvent, url: string, frameName: string, disposition: string, options: Electron.BrowserWindowConstructorOptions, additionalFeatures: string[], referrer: Electron.Referrer, postBody: Electron.PostBody) => void;
dogancelik/atomic-tweetdeck
typings/atomic-tweetdeck/index.d.ts
TypeScript
TypeAliasDeclaration
type NewWindowEventListenerWrapper = (parentWindow: Electron.BrowserWindow) => NewWindowEventListener;
dogancelik/atomic-tweetdeck
typings/atomic-tweetdeck/index.d.ts
TypeScript
ClassDeclaration
@Component({ moduleId: module.id, selector: 'top-nav', templateUrl: 'topnav.html', }) export class TopNavComponent implements OnInit { usuario: Usuario; constructor(private router: Router) {} /*Métodos*/ public ngOnInit(): void { this.usuario = JSON.parse(localStorage.getItem('usuario_investimento')); } changeTheme(color: string): void { var link: any = $('<link>'); link .appendTo('head') .attr({type : 'text/css', rel : 'stylesheet'}) .attr('href', 'themes/app-'+color+'.css'); } rtl(): void { var body: any = $('body'); body.toggleClass('rtl'); } sidebarToggler(): void { var sidebar: any = $('#sidebar'); var mainContainer: any = $('.main-container'); sidebar.toggleClass('sidebar-left-zero'); mainContainer.toggleClass('main-container-ml-zero'); } logout(): void { localStorage.removeItem('id_token'); localStorage.removeItem('usuario_investimento'); this.router.navigate(['']); } }
gerica/InvestimentoCliente
src/client/app/shared/topnav/topnav.ts
TypeScript
MethodDeclaration
/*Métodos*/ public ngOnInit(): void { this.usuario = JSON.parse(localStorage.getItem('usuario_investimento')); }
gerica/InvestimentoCliente
src/client/app/shared/topnav/topnav.ts
TypeScript
MethodDeclaration
changeTheme(color: string): void { var link: any = $('<link>'); link .appendTo('head') .attr({type : 'text/css', rel : 'stylesheet'}) .attr('href', 'themes/app-'+color+'.css'); }
gerica/InvestimentoCliente
src/client/app/shared/topnav/topnav.ts
TypeScript
MethodDeclaration
rtl(): void { var body: any = $('body'); body.toggleClass('rtl'); }
gerica/InvestimentoCliente
src/client/app/shared/topnav/topnav.ts
TypeScript
MethodDeclaration
sidebarToggler(): void { var sidebar: any = $('#sidebar'); var mainContainer: any = $('.main-container'); sidebar.toggleClass('sidebar-left-zero'); mainContainer.toggleClass('main-container-ml-zero'); }
gerica/InvestimentoCliente
src/client/app/shared/topnav/topnav.ts
TypeScript
MethodDeclaration
logout(): void { localStorage.removeItem('id_token'); localStorage.removeItem('usuario_investimento'); this.router.navigate(['']); }
gerica/InvestimentoCliente
src/client/app/shared/topnav/topnav.ts
TypeScript
InterfaceDeclaration
export interface Handlers { // Form submit handler handleFormSubmit: (onSubmit: (values: object) => void) => (e: React.FormEvent<Element>) => void; // Form reset handler handleFormReset: (onReset?: (e: React.FormEvent<Element>) => void) => (e: React.FormEvent<Element>) => void; // Common Focus handler handleFocus: (name: string, onFocus: (e: any) => void) => (event: any) => void; // Text change handler handleTextChange: (name: string) => (event: React.FormEvent<HTMLInputElement>) => void; // Number Change handler handleNumberChange: (name: string) => (event: React.FormEvent<HTMLInputElement>) => void; // RadioGroup change handler handleRadioGroupChange: (name: string) => (value: any) => void; // SingleSelect change handler handleSingleSelectChange: (name: string) => (value: any) => void; // DatePicker Component handleDateChange: (name: string, displayFormat: DisplayFormat) => (value: any) => void; // DateRangePicker Component handleDateRangeChange: (name: string, displayFormat: DisplayFormat) => (value: any) => void; // CheckboxGroup change handler handleCheckboxGroupChange: (name: string) => (values: any[]) => void; // MultiSelect change handler handleMultiSelectChange: (name: string) => (values: any[]) => void; // Checkbox change handler handleCheckboxChange: (name: string) => (event: React.FormEvent<HTMLInputElement>) => void; // File input Component handleFileChange: (name: string, maxSize?: number, onError?: (key: string, message: string) => void) => (files: FileList) => void; // Generic Change handleChange: (name: string, value: any) => void; // Common Focus handler getPeriodFromDates: ( startDate: string | Date, endDate: string | Date, displayFormat: DisplayFormat ) => { startDate: Date; endDate: Date }; }
Bhusnar5044/medly-components
packages/forms/src/hooks/useForm/types.ts
TypeScript
InterfaceDeclaration
export interface UseFormResult { // Form key formKey: number; // Form fields values values: { [K: string]: any }; // Form fields handlers handlers: Handlers; // Form fields error messages errorMessages: { [K: string]: any }; // Function to change error messages addErrorMessage: (key: string, message: string) => void; // Function can be called to reset the values setValues: React.Dispatch<React.SetStateAction<{}>>; // Function can be called to reset the error messages setErrorMessages: React.Dispatch<React.SetStateAction<{}>>; }
Bhusnar5044/medly-components
packages/forms/src/hooks/useForm/types.ts
TypeScript
FunctionDeclaration
export function getOverrideExcelButton(bc: IBuilderConfig) { const {overrides} = mergeComponents(bc.topbtn, { "Override Excel Button": getBtnExcelConfig(bc), }); return overrides["Override Excel Button"]; }
honyrikS/core-frontend
packages/@essence/essence-constructor-classes/src/Grid/utils/getGridBtnsConfig.ts
TypeScript
FunctionDeclaration
export function getOverrideDragDropButton(bc: IBuilderConfig) { const {overrides} = mergeComponents(bc.topbtn, { "Override DragDrop Button": getDragDropBtnConfig(bc), }); return overrides["Override DragDrop Button"]; }
honyrikS/core-frontend
packages/@essence/essence-constructor-classes/src/Grid/utils/getGridBtnsConfig.ts
TypeScript