nbd-wtf / nostr-tools

Tools for developing Nostr clients.
The Unlicense
705 stars 197 forks source link

Relay Example in Angular #367

Closed seanmurphy1661 closed 8 months ago

seanmurphy1661 commented 8 months ago

Anyone get the relay example to work in angular? I'm getting tons events. I'm just having a mental block on getting them out of the onevent function to manipulate.

fiatjaf commented 8 months ago

Like this?

let events = []

relay.subscribe(_, _, {
  onevent(event) {
    events.push(event)
  }
})
seanmurphy1661 commented 8 months ago

V similar to what I had to do. I could not access a component property in the code block, but I can access a var local to the calling function. set the property to the local var, done. angular can make the simplest thing difficult.