@zardoy/vk-params
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

VK Params · npm version GitHub top language gitmoji badge semantic-release

A small helper for working with VK launch params [ru]. Useful for vk-mini-apps.

Usage

import { vkGetParam } from "@zardoy/vk-params";

// No vk_ prefix needed
vkGetParam("app_id");
//=> 6739175

vkGetParam("are_notifications_enabled");
//=> false

API

vkGetParam(param)

Return value depends on param argument.

It is important to know, that if appropriate param in url doesn't exist this function will throw an Error.

vkIsDesktopVersion(): boolean

Shortcut for vkGetParam("platform") === "desktop_web".

paramNames

Array of names all VK launch params.

nullableParamNames

Same as previous, but contains only params that may not exist in url.

Things to note

  • If you are using React, you should use Error Boundary in the root of your app.
  • For proper typings support, use TypeScript v4 or higher.

Stats, file list and more package details

Please, let me know if you find a better alternative to this module.

Package Sidebar

Install

npm i @zardoy/vk-params

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

10.1 kB

Total Files

5

Last publish

Collaborators

  • zardoy