https://github.com/1amageek/classy
classy provides getter / setter to typescript.
https://github.com/1amageek/classy
getter setter typescript typescript-library
Last synced: 3 months ago
JSON representation
classy provides getter / setter to typescript.
- Host: GitHub
- URL: https://github.com/1amageek/classy
- Owner: 1amageek
- License: mit
- Created: 2018-03-16T13:53:57.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-16T14:08:56.000Z (over 8 years ago)
- Last Synced: 2025-08-16T15:49:01.648Z (11 months ago)
- Topics: getter, setter, typescript, typescript-library
- Language: TypeScript
- Homepage:
- Size: 9.77 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# classy
classy provides getter / setter to typescript.
## Install
```
npm add @1amageek/classy
```
## Usage
```typescript
import { classy, property } from '@1amageek/classy'
@classy
export class Document {
// willSet / didSet
@property({
willSet: (newValue) => {
console.log(newValue)
},
didSet: (oldValue) => {
console.log(oldValue)
}
}) public test0: string
_privateValue: string
// getter / setter
@property({
set: (newValue, self) => {
self._privateValue = newValue
},
get: (self) => {
return self._privateValue
}
}) public test1: string
constructor() {
}
}
```