SponsorkitBadgeElement

<sponsorkit-badge github open-collective>: shows "Supporter ♥" when the signed-in user has an active contribution, and nothing otherwise.

On this page

<sponsorkit-badge github open-collective>: shows "Supporter ♥" when the signed-in user has an active contribution, and nothing otherwise. Call refresh() after signing in or checking out.

import { SponsorkitBadgeElement } from "@sponsorkit/sdk/elements";

class SponsorkitBadgeElement extends SponsorkitElementBase { … }

Class, exported from @sponsorkit/sdk/elements.

Properties#

client#

set client(client: Sponsorkit | null)
get client(): Sponsorkit | null

Use a pre-configured client instead of one built from attributes. The client for this element (built from the github, open-collective, api-base-url and site-base-url attributes).

Methods#

connectedCallback()#

connectedCallback(): void

Returns void

attributeChangedCallback()#

attributeChangedCallback(): void

Returns void

refresh()#

async refresh(): Promise<boolean>

Re-reads the contribution (served from cache when fresh) and updates visibility. Resolves whether the badge is shown.

Returns Promise<boolean>

Static members#

SponsorkitBadgeElement.observedAttributes#

static readonly observedAttributes = ["github", "open-collective", "api-base-url", "site-base-url"]