MCPcopy Create free account
hub / github.com/efogdev/mpris-timer / broadcast

Method broadcast

internal/core/core.go:306–331  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

304}
305
306func (p *TimerPlayer) broadcast() {
307 if p.progress >= 100 {
308 return
309 }
310
311 for _, cb := range p.subscribers {
312 if cb == nil {
313 continue
314 }
315
316 prev := p.lastEvent
317 img := strings.TrimPrefix(p.img, "file://")
318 if prev != nil && prev.Img == img && prev.Text == p.progressText && prev.IsPaused == p.isPaused {
319 continue
320 }
321
322 ev := PropsChangedEvent{
323 Img: img,
324 Text: p.progressText,
325 IsPaused: p.isPaused && !p.IsFinished,
326 }
327
328 p.lastEvent = &ev
329 cb(ev)
330 }
331}

Callers 3

runTickerMethod · 0.95
PlayPauseMethod · 0.95
PreviousMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected