123456789101112131415161718192021222324252627282930 |
- import { Injectable } from "@angular/core";
- import Gun from "gun";
- /*
- Generated class for the P2pDatabaseGunProvider provider.
- See https://angular.io/guide/dependency-injection for more info on providers
- and Angular DI.
- */
- @Injectable()
- export class P2pDatabaseGunProvider {
- private gun;
- constructor() {
- this.gun = Gun();
- }
- public storeLastTweetHashForUser(userid, hash): void {
- this.gun.get(userid).put({ lastTweet: hash });
- }
- public async getLastTweetFromUser(userid) {
- return new Promise(resolve =>
- this.gun
- .get(userid)
- .get("lastTweet")
- .once(resolve)
- );
- }
- }
|