1.1.1 • Published 5 years ago

ts-annotation v1.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

typescript annotation

目录

安装

$ npm install ts-annotation

介绍

ts-annotation用typescript写的装饰器(注解), 当前typescript的版本号为3.4.3.

使用

代码在 /test/index.ts

class Test {
    // 100ms内最多渲染一次
    @Debounce(100)
    render() {}
    
    // 处理前
    @Before()
    getData() {}
    // 处理
    @Around()
    dealData() {}
    处理后
    @After()
    showData() {}
    
    // 防抖
    @Leading(100)
    fetch() {}
    // 去除两边的空格,可以对对象使用
    @Validate
    show(@Trim message) {}
    
    // 移除所有null undefined ''
    @Validata
    show(@RemoveEmpty message) {}
}

注意

需要安装tsc 使用Around注解默认是异步的,所以需要注意用async await或者promise

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.11

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago