Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🚀 Use Lanyard API easily in your React app!

License

NotificationsYou must be signed in to change notification settings

barbarbar338/react-use-lanyard

Repository files navigation

starslicensesupportServerforksissues

Logo

React Use Lanyard

Use Lanyard API easily in your React app!
Get support »

Report Bug ·Request Feature ·What Is Lanyard

📦 Installation

  • Using yarn:yarn add react-use-lanyard
  • Using npm:npm i react-use-lanyard

🤓 Usage

Using without websocket:

import{useLanyard}from"react-use-lanyard";functionApp(){constlanyard=useLanyard({userId:"952574663916154960",});return(<pre>{!lanyard.isValidating&&JSON.stringify(lanyard,null,4)}</pre>);}exportdefaultApp;

Using with websocket:

import{useLanyard}from"react-use-lanyard";functionApp(){const{ loading, status/*, websocket */}=useLanyard({userId:"952574663916154960",socket:true,});return<pre>{!loading&&JSON.stringify(status,null,4)}</pre>;}exportdefaultApp;

🔐 KV Support

You can create/delete KV pairs using this package.

import{set,del}from"react-use-lanyard";// Set KV pairawaitset({apiKey:"your_api_key",// get it using .apikey command on lanyard botuserId:"your_user_id",key:"test_key",value:"test value",// apiUrl: "lanyard.338.rocks", // if you are using self-hosted api, not required by default});// Delete KV pairawaitdel({apiKey:"your_api_key",userId:"your_user_id",key:"test_key",// apiUrl: "lanyard.338.rocks", // if you are using self-hosted api, not required by default});

🤞 Using Self-Hosted API

You can use this package to connect to your own self-hosted Lanyard API. To do this, you need to pass theapiUrl option to theuseLanyard hook. SeeLanyard self-hosting guide for more information.

Using without websocket:

import{useLanyard}from"react-use-lanyard";functionApp(){constlanyard=useLanyard({userId:"952574663916154960",apiUrl:"lanyard.338.rocks",});return(<pre>{!lanyard.isValidating&&JSON.stringify(lanyard,null,4)}</pre>);}exportdefaultApp;

Using with websocket:

import{useLanyard}from"react-use-lanyard";functionApp(){const{ loading, status/*, websocket */}=useLanyard({userId:"952574663916154960",socket:true,apiUrl:"lanyard.338.rocks",});return<pre>{!loading&&JSON.stringify(status,null,4)}</pre>;}exportdefaultApp;

📄 License

Copyright © 2021Barış DEMİRCİ.

Distributed under theGPL-3.0 License. SeeLICENSE for more information.

🧦 Contributing

Feel free to use GitHub's features.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/my-feature)
  3. Run prettier and eslint (npm run format && npm run lint)
  4. Commit your Changes (git commit -m 'my awesome feature my-feature')
  5. Push to the Branch (git push origin feature/my-feature)
  6. Open a Pull Request

🔥 Show your support

Give a ⭐️ if this project helped you!

📞 Contact

✨ Special Thanks


[8]ページ先頭

©2009-2025 Movatter.jp