Skip to content

Add Observable for Set Events #89

Closed
@iamwyza

Description

@iamwyza

It would be nice to be able to have an observable that listens to all Set Events such that if I call this.localstorage.set("mykey", value); in class X, I could then have a subscriber in class Y that hears that the value in the DB has been updated/set.

class WidgetThing {
    constructor(private readonly localStorage: LocalStorage) {}
    public SetData() {
       this.localStorage.Set("MyKey", "some random data").subscribe();
    }
}

class SomeOtherClass {
   constructor(private readonly localStorage: LocalStorage) {
       this.localStorage.Events<T>("MyKey").subscribe((data: T, event: string) =>{
           console.log("something happened to MyKey!, it was " + event);
       });
   }
}

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions