Skip to content

Commit

Permalink
Remove testing and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tiger5226 committed Sep 8, 2020
1 parent f8ee520 commit 05f7bb5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 26 deletions.
2 changes: 2 additions & 0 deletions notifications/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
const payment = "payment"
const newClaim = "new_claim"

// PaymentEvent event to notify subscribers of a payment transaction
func PaymentEvent(lbc float64, address, txid string, vout uint) {
values := url.Values{}
values.Add("lbc", cast.ToString(lbc))
Expand All @@ -18,6 +19,7 @@ func PaymentEvent(lbc float64, address, txid string, vout uint) {
go Notify(payment, values)
}

// ClaimEvent event to notify subscribers of a new claim thats been published
func ClaimEvent(claimID, name, title, txID, channeClaimID string) {
values := url.Values{}
values.Add("claim_id", claimID)
Expand Down
26 changes: 0 additions & 26 deletions notifications/notification_test.go

This file was deleted.

3 changes: 3 additions & 0 deletions notifications/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type subscriber struct {

var subscriptions map[string][]subscriber

// AddSubscriber adds a subscriber to the subscribers list for a type
func AddSubscriber(address, subType string, params map[string]interface{}) {
if subscriptions == nil {
subscriptions = make(map[string][]subscriber)
Expand All @@ -31,10 +32,12 @@ func AddSubscriber(address, subType string, params map[string]interface{}) {
subscriptions[subType] = append(subscriptions[subType], subscriber{URL: address, Type: subType, Params: urlParams})
}

// ClearSubscribers clears the list of subscribers
func ClearSubscribers() {
subscriptions = make(map[string][]subscriber)
}

// Notify notifies the list of subscribers for a type
func Notify(t string, values url.Values) {
subs, ok := subscriptions[t]
if ok {
Expand Down

0 comments on commit 05f7bb5

Please sign in to comment.