shadow.js
v1.0.2
Published
"# My project's README"
Downloads
6
Readme
API
get(key:string)
Get the current value and all other remaining value
watch(key:string)
Get any new values that are set
also(...keys:string[])
If you want to watch more properties. You can do that
Examples as Test Cases
import "rxjs/add/operator/take"
import "rxjs/add/operator/finally"
import {expect} from "chai"
import { Shadow } from 'shadow.js';
describe("Shadow",()=>{
function setup(){
return Shadow.create({
name:"Shavyg",
age:27
})
}
let person = setup();
beforeEach(()=>person=setup());
//you can watch for a propert change on anything
it("Should be able to watch shaded properties",(done)=>{
Shadow(person).watch("name").subscribe(()=>{
done();
});
person.name = "Pizza";
person.age = 1000;
})
it("Should be able to get shaded properties",(done)=>{
Shadow(person).get("name").take(2).finally(done).subscribe();
person.name = "Pizza";
person.age = 1000;
})
it("should be able to shadow new properties",(done)=>{
Shadow(person).also("race")
Shadow(person).watch("race").take(1).subscribe(()=>{
done();
});
(person as any).race = "super";
})
afterEach(()=>{
Shadow(person).clear();
})
})