New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@naylour/telegram

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@naylour/telegram

  • 1.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
decreased by-45%
Maintainers
0
Weekly downloads
 
Created
Source

Library description @naylour/telegram

The @naylour/telegram library provides convenient tools for integrating your application with Telegram Web Apps. It provides several modules that allow you to work with platforms, organize reactive interaction with Telegram, as well as use Svelte and its capabilities for status management. Installation

Install the library via npm:

npm install @naylour/telegram

Main features

  1. Storing information about supported platforms: a list of platforms/environments for integration with Telegram.
  2. Svelte Storage: A convenient way to manage the Telegram Web App status in your Svelte applications.
  3. Svelte 5-based reactivity: powerful and flexible tools for working with Telegram through the new Svelte 5 features (runes).

Modules

1. @naylour/telegram

At the moment, the root module contains only the array of available Telegram platforms. Using:

import { platforms } from '@naylour/telegram';

console.log(platforms); // ['web', 'ios', 'desktop', ...]

2. @naylour/telegram/store

The module provides ready-made Svelte storage (writable), which simplifies interaction with the Telegram Web App API. This module is ideal for Svelte applications where reactive Telegram status management is required.

Features:

  1. Automatic initialization of window. Telegram.
  2. State management, including data about the user, themes, buttons, and events.
  3. A simple subscription for changes via the $store.

Methods and fields are represented as a class field, so the syntax with the $ sign is not required.

Using:

<script lang="ts">
    import { setContext } from '@naylour/telegram/store';

    const telegram = setContext();
</script>

{#if telegram.isReady}
    <p>The application is initialized</p>
{:else}
    <p>The application is not initialized</p>
{/if}


3. @naylour/telegram/reactivity

The module provides tools for working with the Telegram Web App based on runes from Svelte 5. This is a modern approach to organizing reactive interaction with Telegram, which allows you to create concise and flexible code.

Features:

  1. Easy integration with the Telegram Web App API.
  2. Using Svelte 5 runes to manage status and subscribe to events.
  3. User-friendly management of user data and themes.

When to use

  1. @naylour/telegram: Use it if you need to identify or work with supported Telegram platforms.

  2. @naylour/telegram/store: If you use Svelte 3/4 and want to quickly add reactive Telegram Web App status management to your app.

  3. @naylour/telegram/reactivity: If you use Svelte 5 and prefer to use runes for reactive interaction with Telegram.

Advantages of the library

  1. Ease of use: The library provides ready-made tools that simplify the integration of Telegram Web Apps.
  2. Reactivity: All modules are focused on reactive state management, which is ideal for modern frameworks.
  3. Flexibility: Support for both old approaches (via Svelte repositories) and new ones (via Svelte 5 runes).
  4. Typing: All modules are fully typed (TypeScript), which makes development more reliable.
The implementation of the two options (Writable store & Runes) is done in such a way as to eliminate the features of the various methods ($), while maintaining reactive operation and adding more flexibility.

Keywords

FAQs

Package last updated on 04 Jan 2025

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