Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/artemavramenko/propjet.js

Reactive properties for JavaScript and TypeScript
https://github.com/artemavramenko/propjet.js

reactive-programming typescript

Last synced: 29 days ago
JSON representation

Reactive properties for JavaScript and TypeScript

Awesome Lists containing this project

README

        

# propjet.js
JavaScript/TypeScript library for declaring reactive properties.

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

Code licensed under [MIT License](LICENSE).

# Installing
* Via [NuGet](https://www.nuget.org/packages/propjet.js/): `$ Install-Package propjet.js`
* Via [Bower](http://bower.io/): `$ bower install propjet.js`
* Manually: extract files from [PropjetJS.zip](PropjetJS.zip?raw=true)

# Example
```TypeScript
class Person
{
constructor()
{
propjet(this);
}

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

lastName = "";

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

propIE8 = propjet()
.default(() => "Hello, IE!")
.declare(true); // function mode: get - propIE8(), set - propIE8(newValue)
}
```
more - [documentation](../../wiki/Documentation), [AngularJS demo](demo.ts), [Jasmine specs](src/propjet.spec.ts)