markmap-common
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -1,2 +0,2 @@ | ||
/*! markmap-common v0.1.5 | MIT License */ | ||
/*! markmap-common v0.1.6 | MIT License */ | ||
class Hook { | ||
@@ -183,3 +183,4 @@ constructor() { | ||
const ctx = { | ||
args | ||
args, | ||
thisObj: this | ||
}; | ||
@@ -192,3 +193,3 @@ | ||
ctx.result = fn(...args); | ||
ctx.result = fn.apply(ctx.thisObj, ctx.args); | ||
@@ -195,0 +196,0 @@ try { |
@@ -1,2 +0,2 @@ | ||
/*! markmap-common v0.1.5 | MIT License */ | ||
/*! markmap-common v0.1.6 | MIT License */ | ||
'use strict'; | ||
@@ -187,3 +187,4 @@ | ||
const ctx = { | ||
args | ||
args, | ||
thisObj: this | ||
}; | ||
@@ -196,3 +197,3 @@ | ||
ctx.result = fn(...args); | ||
ctx.result = fn.apply(ctx.thisObj, ctx.args); | ||
@@ -199,0 +200,0 @@ try { |
{ | ||
"name": "markmap-common", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "", | ||
@@ -10,3 +10,2 @@ "author": "", | ||
"clean": "del-cli dist types", | ||
"lint": "eslint --ext .ts,.tsx .", | ||
"build:types": "tsc", | ||
@@ -29,3 +28,3 @@ "build:js": "rollup -c rollup.conf.js" | ||
}, | ||
"gitHead": "cbb56b8ede93b15000a31013a0474891b774a977" | ||
"gitHead": "fbec667e1706813f9f60bea6a971f3820858ca40" | ||
} |
@@ -1,7 +0,8 @@ | ||
export declare class Hook<T extends (...args: any[]) => void> { | ||
protected listeners: T[]; | ||
tap(fn: T): () => void; | ||
revoke(fn: T): void; | ||
export declare type HookCallback<T extends any[]> = (...args: T) => void; | ||
export declare class Hook<T extends any[]> { | ||
protected listeners: Array<HookCallback<T>>; | ||
tap(fn: HookCallback<T>): () => void; | ||
revoke(fn: HookCallback<T>): void; | ||
revokeAll(): void; | ||
call(...args: Parameters<T>): void; | ||
call(...args: T): void; | ||
} |
@@ -0,0 +0,0 @@ import { JSItem, CSSItem } from './types'; |
@@ -0,0 +0,0 @@ export * from './hook'; |
import { JSItem, CSSItem } from './types'; | ||
export declare function loadJS(items: JSItem[], context?: any): Promise<void>; | ||
export declare function loadCSS(items: CSSItem[]): void; |
@@ -46,2 +46,3 @@ export interface IHierarchy<T> { | ||
export interface IWrapContext<T extends (...args: any[]) => any> { | ||
thisObj: any; | ||
args: Parameters<T>; | ||
@@ -48,0 +49,0 @@ result?: ReturnType<T>; |
export * from './common'; |
@@ -9,3 +9,3 @@ import { IWrapContext, IDeferred } from './types'; | ||
export declare function childSelector<T extends Element>(filter?: string | ((el: T) => boolean)): () => T[]; | ||
export declare function wrapFunction<T extends (...args: any[]) => any>(fn: T, { before, after }: { | ||
export declare function wrapFunction<T extends (...args: any[]) => any>(fn: T, { before, after, }: { | ||
before?: (ctx: IWrapContext<T>) => void; | ||
@@ -12,0 +12,0 @@ after?: (ctx: IWrapContext<T>) => void; |
20116
650