0.1.0 • Published 6 years ago

@1amageek/classy v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

classy

classy provides getter / setter to typescript.

Install

npm add @1amageek/classy

Usage

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() {

    }
}