0.0.2 • Published 6 years ago

ng-ansible v0.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

ng-ansible

An Angular service for using Ansibles, generalised state channels enforced on the Ethereum blockchain. This service is provided as a wrapper for an Ansible Relay to make some of the operations more convenient - it does not handle any custom Speaker interaction.

Events

To get all past events for a given Ansible, use the getAnsibleEvents(ansibleID) method, and use watchAnsibleEvents(ansibleID) to watch for future events.

Examples

constructor(
    private ansibleService : AnsibleService
){}

watchSpeakerOpens() {
    let speaker = "0x0";
    this.ansibleService.watchSpeakerOpens(speaker).subscribe(e => {
        // will be fired every time an event is found
    });
}

getAnsibleCheckpoints() {
    let id = 1000;
    this.ansibleService.getAnsibleCheckpoints(id).subscribe(events => {
        // an array of all prior checkpoints
    });
}

watchSpeakerEvents() {
    let speaker = "0x0";
    this.ansibleService.watchSpeakerEvents(speaker).subscribe(e => {
        // will be fired every time an event is found
    });
}

watchAnsibleEvents() {
    let ansibleID = 1000;
    this.ansibleService.watchAnsibleEvents(ansibleID).subscribe(e => {
        // will be fired every time an event is found
    });
}

watchSpeakerEvents() {
    let speaker = "0x0";
    this.ansibleService.watchSpeakerEvents(speaker).subscribe(e => {
        // will be fired every time an event is found
    });
}