Skip to content

Commit 027b8b3

Browse files
committed
init
0 parents  commit 027b8b3

31 files changed

+3846
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
ts-temp/

.npmignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# ide
2+
.komodotools
3+
*.komodoproject
4+
5+
.gitignore
6+
.gitmodules
7+
.gitattributes
8+
.npmignore
9+
10+
.travis.yml
11+
12+
build.js
13+
node_modules/
14+
tools/
15+
test/
16+
src/
17+
builds/
18+
examples/
19+
ts-temp/

.travis.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
sudo: false
2+
3+
before_script:
4+
- export DISPLAY=:99.0
5+
- sh -e /etc/init.d/xvfb start
6+
- sleep 5
7+
- npm run build &
8+
- npm run server &
9+
- sleep 5
10+
- firefox http://localhost:5777/utest/ &
11+
- sleep 5
12+
13+
script:
14+
- "npm test"
15+
16+
language: node_js
17+
18+
node_js:
19+
- "6.6.0"
20+
21+
addons:
22+
firefox: "latest"

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"typescript.tsdk": "node_modules\\typescript\\lib"
3+
}

lib/memd.d.ts

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
// Generated by dts-bundle v0.7.3
2+
3+
declare module 'memd' {
4+
import { deco_memoize } from 'memd/deco/memoize';
5+
import { deco_debounce } from 'memd/deco/debounce';
6+
import { deco_throttle } from 'memd/deco/throttle';
7+
import { deco_queued } from 'memd/deco/queued';
8+
import { fn_memoize } from 'memd/fn/memoize';
9+
import { Cache } from 'memd/Cache';
10+
class Memd {
11+
static Cache: typeof Cache;
12+
static fn: {
13+
memoize: typeof fn_memoize;
14+
};
15+
static deco: {
16+
memoize: typeof deco_memoize;
17+
throttle: typeof deco_throttle;
18+
debounce: typeof deco_debounce;
19+
queued: typeof deco_queued;
20+
};
21+
static default: typeof Memd;
22+
}
23+
export = Memd;
24+
}
25+
26+
declare module 'memd/deco/memoize' {
27+
import { ICacheOpts } from 'memd/Cache';
28+
export function deco_memoize(opts?: ICacheOpts): (target: any, propertyKey: any, descriptor?: any) => any;
29+
}
30+
31+
declare module 'memd/deco/debounce' {
32+
/**
33+
*
34+
* @param timeout ms to wait before calling inner fn
35+
*/
36+
export function deco_debounce(timeout?: number): (target: any, propertyKey: any, descriptor?: any) => any;
37+
}
38+
39+
declare module 'memd/deco/throttle' {
40+
/**
41+
* Calls function maximal each time window frame
42+
* @param timeWindow how often, in ms, should the function be called
43+
* @param shouldCallLater start calling fn on frame start
44+
*/
45+
export function deco_throttle(timeWindow: number, shouldCallLater?: boolean): (target: any, propertyKey: any, descriptor?: any) => any;
46+
}
47+
48+
declare module 'memd/deco/queued' {
49+
export function deco_queued(opts?: {
50+
trimQueue: boolean;
51+
}): (target: any, propertyKey: any, descriptor?: any) => any;
52+
}
53+
54+
declare module 'memd/fn/memoize' {
55+
import { IMemoizeWrapper } from 'memd/model/IMemoizeWrapper';
56+
import { ICacheOpts } from 'memd/Cache';
57+
export function fn_memoize<T extends Function>(fn: T, opts?: ICacheOpts): IMemoizeWrapper<T>;
58+
}
59+
60+
declare module 'memd/Cache' {
61+
export interface ICacheOpts {
62+
maxAge?: number;
63+
monitors?: ICacheChangeEventMonitor[];
64+
keyResolver?: (...args: any[]) => string;
65+
}
66+
export interface ICacheChangeEventMonitor {
67+
on(event: 'change', fn: Function): any;
68+
off(event: 'change', fn: Function): any;
69+
}
70+
export interface ICacheEntry<T = any> {
71+
timestamp: number;
72+
value: T;
73+
}
74+
export class Cache<T = any> {
75+
options: ICacheOpts;
76+
constructor(options?: ICacheOpts);
77+
resolveKey(...args: any[]): string;
78+
get(key: string): T;
79+
set(key: string, val: T): T;
80+
clear(key?: string): void;
81+
destroy(): void;
82+
}
83+
}
84+
85+
declare module 'memd/model/IMemoizeWrapper' {
86+
export interface IMemoizeWrapper<T extends Function> {
87+
(fn: T): T;
88+
clearArgs(...args: any[]): any;
89+
clearAll(): any;
90+
}
91+
}
92+

0 commit comments

Comments
 (0)