Developers

wp.hooks.doAction( 'riff.like', detail, api )

Fires when a like is added or taken away, and once the likes a visitor kept in this browser have joined their account after they signed in.

Also dispatched as the riff:like event on #riff, with the same detail. The event bubbles.

Parameters

detailObject
What changed.
  • changestring
    like, unlike or sync.
  • kindstring|null
    track, album or artist; null for sync.
  • idnumber|null
    Its ID; null for sync.
  • likesObject[]
    Every like, newest first, each { kind, id, at }.
apiObject
window.riff.

More Information

Usage

wp.hooks.addAction( 'riff.like', 'my-plugin', ( detail, api ) => {
} );

// Or, without wp-hooks:
window.riff.on( 'like', ( detail ) => {} );

Source

emit( 'like', { change, kind, id, likes: api.likes() } );

Changelog

VersionDescription
4.20.0Introduced.