File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 "name" : " decko" ,
33 "version" : " 1.1.3" ,
44 "main" : " decko.js" ,
5+ "types" : " index.d.ts" ,
56 "description" : " A collection of the most useful property decorators." ,
67 "scripts" : {
7- "build" : " babel -f $npm_package_main -s -o $npm_package_main < src/${npm_package_main}" ,
8- "test" : " eslint {src,tests}/**.js && mocha --compilers js:babel/register tests/**/*.js" ,
8+ "build" : " babel -f $npm_package_main -s -o $npm_package_main < src/${npm_package_main} && npm run build:ts" ,
9+ "build:ts" : " cp src/decko.d.ts index.d.ts" ,
10+ "test" : " npm run test:ts && eslint {src,tests}/**.js && mocha --compilers js:babel/register tests/**/*.js" ,
11+ "test:ts" : " tsc -p ./" ,
12+ "style:ts" : " tsfmt -r" ,
913 "prepublish" : " npm run build" ,
1014 "release" : " npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"
1115 },
1822 "babel-eslint" : " ^4.1.6" ,
1923 "chai" : " ^3.2.0" ,
2024 "eslint" : " ^1.10.3" ,
21- "mocha" : " ^2.3.0"
25+ "mocha" : " ^2.3.0" ,
26+ "typescript" : " 2.1.6" ,
27+ "typescript-formatter" : " 4.1.1"
2228 }
2329}
Original file line number Diff line number Diff line change 1+ /**
2+ *
3+ */
4+ export function bind < T > (
5+ target : Object ,
6+ propertyKey : string | symbol ,
7+ descriptor ?: TypedPropertyDescriptor < T >
8+ ) : TypedPropertyDescriptor < T > | void ;
9+ export function bind ( ) : MethodDecorator ;
10+
11+ /**
12+ * @param caseSensitive Makes cache keys case-insensitive
13+ * @param cache Presupply cache storage, for seeding or sharing entries
14+ */
15+
16+ export function memoize < T > (
17+ target : Object ,
18+ propertyKey : string | symbol ,
19+ descriptor ?: TypedPropertyDescriptor < T >
20+ ) : TypedPropertyDescriptor < T > | void ;
21+ export function memoize ( caseSensitive ?: boolean , cache ?: Object ) : MethodDecorator ;
22+ /**
23+ * @param delay number
24+ */
25+ export function debounce < T > (
26+ target : Object ,
27+ propertyKey : string | symbol ,
28+ descriptor ?: TypedPropertyDescriptor < T >
29+ ) : TypedPropertyDescriptor < T > | void ;
30+ export function debounce ( delay ?: number ) : MethodDecorator ;
Original file line number Diff line number Diff line change 1+ import { bind , debounce , memoize } from '..' ;
2+ class C {
3+ @bind
4+ foo ( ) { }
5+
6+ @debounce
7+ moo ( ) { }
8+
9+ @debounce ( 1000 )
10+ mooWithCustomDelay ( ) { }
11+
12+ @memoize
13+ mem ( ) { }
14+
15+ @memoize ( true )
16+ memWithConfig ( ) { }
17+ }
Original file line number Diff line number Diff line change 1+ {
2+ "compilerOptions" : {
3+ "module" : " es2015" ,
4+ "target" : " es2016" ,
5+ "lib" : [
6+ " dom" ,
7+ " es2016"
8+ ],
9+ "baseUrl" : " ./" ,
10+ "noImplicitAny" : true ,
11+ "experimentalDecorators" : true ,
12+ "sourceMap" : false ,
13+ "moduleResolution" : " node" ,
14+ "strictNullChecks" : true ,
15+ "declaration" : true ,
16+ "noEmit" : true ,
17+ "pretty" : true ,
18+ "outDir" : " ts-output"
19+ },
20+ "include" : [
21+ " src/decko.d.ts" ,
22+ " tests/index.ts"
23+ ]
24+ }
You can’t perform that action at this time.
0 commit comments