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

@vkontakte/mvk-mini-apps-scroll-helper

Package Overview
Dependencies
Maintainers
10
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vkontakte/mvk-mini-apps-scroll-helper - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

25

dist/mvk-mini-apps-scroll-helper.cjs.js

@@ -1,1 +0,24 @@

"use strict";var mvkScrollHelper=function(e){if(e&&"string"==typeof e){var o=new URLSearchParams(window.location.search);if((~window.navigator.userAgent.indexOf("iPhone")||~window.navigator.userAgent.indexOf("iPad"))&&o.has("vk_platform")&&"mobile_web"===o.get("vk_platform")){var r=document.getElementById(e);r&&(r.style.overflowY="scroll",r.style.webkitOverflowScrolling="touch")}}};module.exports=mvkScrollHelper;
'use strict';
var PLATFORM_PARAM = 'vk_platform';
var MOBILE_WEB = 'mobile_web';
/**
* @param {HTMLElement|null} appContainerNode
*/
var mvkScrollHelper = function mvkScrollHelper(appContainerNode) {
if (appContainerNode == null) {
return;
}
var searchParams = new URLSearchParams(location.search);
var _navigator = navigator,
userAgent = _navigator.userAgent;
if ((userAgent.includes('iPhone') || userAgent.includes('iPad')) && searchParams.get(PLATFORM_PARAM) === MOBILE_WEB) {
appContainerNode.style.overflowY = 'scroll';
appContainerNode.style.webkitOverflowScrolling = 'touch';
}
};
module.exports = mvkScrollHelper;

@@ -1,1 +0,30 @@

!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e=e||self).mVKMiniAppsScrollHelper=o()}(this,function(){"use strict";return e=>{if(e&&"string"==typeof e){const o=new URLSearchParams(window.location.search);if((~window.navigator.userAgent.indexOf("iPhone")||~window.navigator.userAgent.indexOf("iPad"))&&o.has("vk_platform")&&"mobile_web"===o.get("vk_platform")){const o=document.getElementById(e);o&&(o.style.overflowY="scroll",o.style.webkitOverflowScrolling="touch")}}}});
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.mVKMiniAppsScrollHelper = factory());
}(this, function () { 'use strict';
var PLATFORM_PARAM = 'vk_platform';
var MOBILE_WEB = 'mobile_web';
/**
* @param {HTMLElement|null} appContainerNode
*/
var mvkScrollHelper = function mvkScrollHelper(appContainerNode) {
if (appContainerNode == null) {
return;
}
var searchParams = new URLSearchParams(location.search);
var _navigator = navigator,
userAgent = _navigator.userAgent;
if ((userAgent.includes('iPhone') || userAgent.includes('iPad')) && searchParams.get(PLATFORM_PARAM) === MOBILE_WEB) {
appContainerNode.style.overflowY = 'scroll';
appContainerNode.style.webkitOverflowScrolling = 'touch';
}
};
return mvkScrollHelper;
}));

3

package.json
{
"name": "@vkontakte/mvk-mini-apps-scroll-helper",
"version": "1.0.1",
"version": "1.0.2",
"main": "dist/mvk-mini-apps-scroll-helper.cjs.js",
"module": "dist/mvk-mini-apps-scroll-helper.esm.js",
"browser": "dist/mvk-mini-apps-scroll-helper.umd.js",

@@ -7,0 +6,0 @@ "umdName": "mVKMiniAppsScrollHelper",

@@ -8,4 +8,4 @@ <div align="center">

[![npm][npm]][npm-url]
[![deps][deps]][deps-url]
[![npm][npm]][npm-url]
[![deps][deps]][deps-url]

@@ -17,4 +17,7 @@ </div>

Хелпер настройки скролла для [VK Mini Apps](https://vk.com/services) на платформе m.vk.com
## Подключение
Добавьте в зависимости пакет:
```bash

@@ -24,3 +27,3 @@ npm i @vkontakte/mvk-mini-apps-scroll-helper

Перед рендером React-приложения вызовите хелпер:
Перед рендером приложения вызовите хелпер:

@@ -30,6 +33,10 @@ ```js

// Вызываем хелпер, передавая в аргумент id ноды-контейнера React-приложения
mVKMiniAppsScrollHelper('root');
// Корневой элемент приложения
const root = document.getElementById('root');
ReactDOM.render(<App />, document.getElementById('root'));
// Вызываем хелпер, передавая в аргумент корневой элемент приложения
mVKMiniAppsScrollHelper(root);
// Рендер приложения
ReactDOM.render(<App />, root);
```

@@ -39,3 +46,2 @@

[npm-url]: https://npmjs.com/package/@vkontakte/mvk-mini-apps-scroll-helper
[deps]: https://img.shields.io/david/vkcom/mvk-mini-apps-scroll-helper.svg

@@ -42,0 +48,0 @@ [deps-url]: https://david-dm.org/vkcom/mvk-mini-apps-scroll-helper

Sorry, the diff of this file is not supported yet

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