Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.06 KB

README.md

File metadata and controls

38 lines (30 loc) · 1.06 KB

propjet.js

JavaScript/TypeScript library for declaring reactive properties.

Supports function mode for outdated browsers (IE8 and below).

Code licensed under MIT License.

Installing

  • Via NuGet: $ Install-Package propjet.js
  • Via Bower: $ bower install propjet.js
  • Manually: extract files from PropjetJS.zip

Example

class Person
{
    constructor()
    {
        propjet(this);
    }

    firstName = propjet<string>()
        .default(() => "Unknown")
        .declare();

    lastName = "";

    fullName = propjet<string>()
        .require(() => this.firstName, () => this.lastName)
        .get((firstName, lastName) => (firstName + " " + lastName).trim())
        .declare();

    propIE8 = propjet<string>()
        .default(() => "Hello, IE!")
        .declare(true); // function mode: get - propIE8(), set - propIE8(newValue)
}

more - documentation, AngularJS demo, Jasmine specs