@zardoy/vk-params
v1.1.0
Published
Helper for working with vk-mini-apps launch params
Downloads
12
Maintainers
Readme
VK Params ·
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)
- param: name of param to get. Use without _vk prefix. A full list of params [ru].
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.