Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svelte-claps

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-claps

Adds clap button (like medium) to any page for your SvelteKit apps.

  • 0.0.7
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

svelte-claps

Adds clap button (like medium) to any page for your SvelteKit apps.

This package originally was created for Next.js by @upstash

Nothing to maintain, it is completely serverless 💯

https://user-images.githubusercontent.com/22038798/183285638-fd7aaa29-4289-455d-8077-3898c21af64f.mov

Installation

1 Create Database

Create a free Redis database at Upstash Console

We will use Upstash Redis to keep the data as well as messaging (Redis pub/sub).

2. Environment Variables

Copy the .env.local.example file to .env.local (which will be ignored by Git):

cp .env.local.example .env.local

UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN can be found at the database details page in Upstash Console.

3. Install Package

npm install --save svelte-claps
# or
yarn add svelte-claps

4. Setup API

Create a new API endpoint for SvelteKit app. Import the package and expose the GET and PATCH methods.

// src/routes/api/claps.js

import createClapsApi from 'svelte-claps';

export const { GET, PATCH } = createClapsApi({ maxClaps: 10 });

5. Use <Claps /> Component

<script lang="ts">
	import { Claps } from 'svelte-claps';
</script>

<div class="container">
	<Claps replyUrl="https://twitter.com/bufgix_" />
</div>

The options can be passed as React props

keytypedefault
key?stringcurrent page path
fixed?"left", "center", "right"
replyUrl?string
apiPath?string/api/claps

pathname of the page is being used as the key/identity to keep the claps count. You can override this giving the key attribute.

FAQs

Package last updated on 07 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc