1.5.4 • Published 6 years ago

@iconplatforms/observe-property v1.5.4

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

@iconplatforms/observe-property

observe for property changes with the power of Es6 Proxy nad RxJS

Uses the Proxy API and RxJS API.

Install

$ npm install @iconplatforms/observe-property

Usage

## TypeScript 
import {ObserveProperty} from '@iconplatforms/observe-property'
import { Subscription } from 'rxjs';

const obj = {
    name: 'test',
    surName: 'test 2'
}

const observer = new ObserveProperty(obj);

const sub$:Subscription = observer.observe('name').subscribe((value) =>{
    if(value === 'Test 6'){
        sub$.unsubscribe();
    }
});

setTimeout(() => {
    obj.name = "Test 6";
    obj.name = "Test 10";
}, 2000); 
## JavaScript 
"use strict";

var ObserveProperty = require("@iconplatforms/observe-property");

var obj = {
    name: 'test',
    surName: 'test 2'
};
const observer = new ObserveProperty(obj);

const sub$:Subscription = observer.observe('name').subscribe((value) =>{
    if(value === 'Test 6'){
        sub$.unsubscribe();
    }
});

setTimeout(() => {
    obj.name = "Test 6";
    obj.name = "Test 10";
}, 2000); 

API

observe (property: string):BehaviorSubject{

Type: Function Returns an Observable Object.

License

MIT © IconPlatforms

1.5.4

6 years ago

1.5.3

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.33

6 years ago

1.4.31

6 years ago

1.4.30

6 years ago

1.4.29

6 years ago

1.4.28

6 years ago

1.4.27

6 years ago

1.4.26

6 years ago