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

@mpxjs/api-proxy

Package Overview
Dependencies
Maintainers
12
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mpxjs/api-proxy - npm Package Compare versions

Comparing version 2.8.63 to 2.8.64-bridgetest

6

package.json
{
"name": "@mpxjs/api-proxy",
"version": "2.8.63",
"version": "2.8.64-bridgetest",
"description": "convert miniprogram API at each end",

@@ -34,3 +34,3 @@ "module": "src/index.js",

"author": "httpsxiao",
"license": "ISC",
"license": "Apache-2.0",
"bugs": {

@@ -43,3 +43,3 @@ "url": "https://github.com/didi/mpx/issues"

},
"gitHead": "c4c20d476f874c8d5b6f6b987e4748444a28b3c5"
"gitHead": "4080623bc3f493d1cfb7a506dffaec0f79084af6"
}

@@ -103,2 +103,5 @@ /**

function throwSSRWarning (info) {
console.error(`[Mpx runtime error]: Dangerous API! ${info}, It may cause some problems, please use this method with caution`)
}
export {

@@ -114,3 +117,4 @@ changeOpts,

isBrowser,
hasOwn
hasOwn,
throwSSRWarning
}
import * as allApi from './web/api'
import { EventChannel } from './web/api/event-channel'
import { genFromMap } from './common/js'

@@ -8,4 +7,2 @@

global.EventChannel = new EventChannel()
Object.keys(allApi).forEach(api => {

@@ -12,0 +9,0 @@ target[api] = function (...args) {

import ActionSheet from './ActionSheet'
import { isBrowser, throwSSRWarning } from '../../../common/js'

@@ -6,2 +7,6 @@ let actionSheet = null

function showActionSheet (options = { itemList: [] }) {
if (!isBrowser) {
throwSSRWarning('showActionSheet API is running in non browser environments')
return
}
if (!actionSheet) { actionSheet = new ActionSheet() }

@@ -8,0 +13,0 @@ return actionSheet.show(options)

@@ -0,1 +1,3 @@

import { isBrowser, throwSSRWarning } from '../../../common/js'
class Animation {

@@ -8,3 +10,3 @@ constructor (options) {

_processSize (size) {
_processSize (size, type) {
if (typeof size === 'number') {

@@ -14,2 +16,6 @@ return `${size}px`

if (size.indexOf('rpx') !== -1) {
if (!isBrowser) {
throwSSRWarning(`Animation's ${type} API cannot use rpx in non browser environments`)
return
}
// 计算rpx折算回px

@@ -34,3 +40,3 @@ const rs = parseInt(size, 10)

case 'height':
value = this._processSize(value)
value = this._processSize(value, type)
this._propMaps[type] = {

@@ -37,0 +43,0 @@ args: [type, value],

@@ -0,1 +1,2 @@

import { isBrowser } from '../../../common/js'
global.__mpxAppCbs = global.__mpxAppCbs || {

@@ -9,3 +10,5 @@ show: [],

function onError (callback) {
global.__mpxAppCbs.error.push(callback)
if (isBrowser) {
global.__mpxAppCbs.error.push(callback)
}
}

@@ -20,3 +23,5 @@

function onAppShow (callback) {
global.__mpxAppCbs.show.push(callback)
if (isBrowser) {
global.__mpxAppCbs.show.push(callback)
}
}

@@ -31,3 +36,5 @@

function onAppHide (callback) {
global.__mpxAppCbs.hide.push(callback)
if (isBrowser) {
global.__mpxAppCbs.hide.push(callback)
}
}

@@ -34,0 +41,0 @@

@@ -0,2 +1,7 @@

import { isBrowser, throwSSRWarning } from '../../../common/js'
export const createInnerAudioContext = () => {
if (!isBrowser) {
throwSSRWarning('createInnerAudioContext API is running in non browser environments')
return
}
// eslint-disable-next-line no-undef

@@ -3,0 +8,0 @@ const audio = new Audio()

import WebIntersectionObserver from './IntersectionObserver'
import { isBrowser, throwSSRWarning } from '../../../common/js'
function createIntersectionObserver (component, options) {
if (!isBrowser) {
throwSSRWarning('createIntersectionObserver API is running in non browser environments')
return
}
return new WebIntersectionObserver(component, options)

@@ -5,0 +10,0 @@ }

import SelectQuery from './SelectQuery'
import { isBrowser, throwSSRWarning } from '../../../common/js'
function createSelectorQuery () {
if (!isBrowser) {
throwSSRWarning('createSelectorQuery API is running in non browser environments')
return
}
return new SelectQuery()

@@ -5,0 +10,0 @@ }

@@ -1,4 +0,8 @@

import { webHandleSuccess, webHandleFail } from '../../../../common/js'
import { webHandleSuccess, webHandleFail, isBrowser, throwSSRWarning } from '../../../../common/js'
export function getNetworkType ({ success, fail = () => {}, complete = () => {} }) {
if (!isBrowser) {
throwSSRWarning('getNetworkType API is running in non browser environments')
return
}
try {

@@ -8,3 +12,3 @@ if (navigator.connection) {

} else {
webHandleSuccess({ networkType: 'unknow' }, success, complete)
webHandleSuccess({ networkType: 'unknown' }, success, complete)
}

@@ -11,0 +15,0 @@ } catch (err) {

@@ -1,2 +0,2 @@

import { isBrowser } from '../../../../common/js/utils'
import { isBrowser, throwSSRWarning } from '../../../../common/js/utils'
const fnMap = new Map()

@@ -16,2 +16,6 @@

export function onNetworkStatusChange (callbackFn) {
if (!isBrowser) {
throwSSRWarning('onNetworkStatusChange API is running in non browser environments')
return
}
if (navigator.connection) {

@@ -33,2 +37,6 @@ const proxyCallback = evt => {

export function offNetworkStatusChange (callbackFn) {
if (!isBrowser) {
throwSSRWarning('offNetworkStatusChange API is running in non browser environments')
return
}
if (navigator.connection) {

@@ -35,0 +43,0 @@ navigator.connection.removeEventListener('change', fnMap.get(callbackFn))

import Modal from './Modal'
import { isBrowser, throwSSRWarning } from '../../../common/js'

@@ -6,2 +7,6 @@ let modal = null

function showModal (options = {}) {
if (!isBrowser) {
throwSSRWarning('showModal API is running in non browser environments')
return
}
if (!modal) { modal = new Modal() }

@@ -8,0 +13,0 @@ return modal.show(options)

@@ -1,5 +0,9 @@

import { webHandleSuccess, webHandleFail } from '../../../common/js'
import { webHandleSuccess, webHandleFail, isBrowser, throwSSRWarning } from '../../../common/js'
import { nextTick } from '../next-tick'
export function pageScrollTo (options) {
if (!isBrowser) {
throwSSRWarning('pageScrollTo API is running in non browser environments')
return
}
nextTick(() => {

@@ -6,0 +10,0 @@ const ms = global.__ms

@@ -1,4 +0,8 @@

import { webHandleSuccess, webHandleFail } from '../../../common/js'
import { webHandleSuccess, webHandleFail, throwSSRWarning, isBrowser } from '../../../common/js'
function stopPullDownRefresh (options = {}) {
if (!isBrowser) {
throwSSRWarning('stopPullDownRefresh API is running in non browser environments')
return
}
const router = global.__mpxRouter

@@ -34,2 +38,6 @@ if (router) {

function startPullDownRefresh (options = {}) {
if (!isBrowser) {
throwSSRWarning('startPullDownRefresh API is running in non browser environments')
return
}
const router = global.__mpxRouter

@@ -36,0 +44,0 @@ if (router) {

@@ -1,2 +0,2 @@

import { webHandleSuccess, webHandleFail, isTabBarPage } from '../../../common/js'
import { webHandleSuccess, webHandleFail, isTabBarPage, throwSSRWarning, isBrowser } from '../../../common/js'
import { EventChannel } from '../event-channel'

@@ -7,2 +7,6 @@

function redirectTo (options = {}) {
if (!isBrowser) {
throwSSRWarning('redirectTo API is running in non browser environments')
return
}
const router = global.__mpxRouter

@@ -43,2 +47,6 @@ if (router) {

function navigateTo (options = {}) {
if (!isBrowser) {
throwSSRWarning('navigateTo API is running in non browser environments')
return
}
const router = global.__mpxRouter

@@ -84,2 +92,6 @@ if (router) {

function navigateBack (options = {}) {
if (!isBrowser) {
throwSSRWarning('navigateBack API is running in non browser environments')
return
}
const router = global.__mpxRouter

@@ -104,2 +116,6 @@ if (router) {

function reLaunch (options = {}) {
if (!isBrowser) {
throwSSRWarning('reLaunch API is running in non browser environments')
return
}
const router = global.__mpxRouter

@@ -148,2 +164,6 @@ if (router) {

function switchTab (options = {}) {
if (!isBrowser) {
throwSSRWarning('switchTab API is running in non browser environments')
return
}
const router = global.__mpxRouter

@@ -150,0 +170,0 @@ if (router) {

@@ -1,4 +0,8 @@

import { webHandleSuccess } from '../../../common/js'
import { isBrowser, throwSSRWarning, webHandleSuccess } from '../../../common/js'
function setNavigationBarTitle (options = {}) {
if (!isBrowser) {
throwSSRWarning('setNavigationBarTitle API is running in non browser environments')
return
}
const { title, success, complete } = options

@@ -14,2 +18,6 @@

function setNavigationBarColor (options = {}) {
if (!isBrowser) {
throwSSRWarning('setNavigationBarColor API is running in non browser environments')
return
}
const { backgroundColor, success, complete } = options

@@ -16,0 +24,0 @@ const meta = document.createElement('meta')

@@ -1,5 +0,9 @@

import { warn, webHandleSuccess, webHandleFail } from '../../../common/js'
import { warn, webHandleSuccess, webHandleFail, isBrowser, throwSSRWarning } from '../../../common/js'
import SocketTask from './SocketTask'
function connectSocket (options = { url: '' }) {
if (!isBrowser) {
throwSSRWarning('connectSocket API is running in non browser environments')
return
}
const { url, protocols, success, fail, complete } = options

@@ -6,0 +10,0 @@

@@ -1,4 +0,8 @@

import { webHandleSuccess, webHandleFail, hasOwn } from '../../../common/js'
import { webHandleSuccess, webHandleFail, hasOwn, isBrowser, throwSSRWarning } from '../../../common/js'
function setStorage (options = {}) {
if (!isBrowser) {
throwSSRWarning('setStorage API is running in non browser environments')
return
}
const { key, data, success, fail, complete } = options

@@ -20,2 +24,6 @@

function setStorageSync (key = '', data) {
if (!isBrowser) {
throwSSRWarning('setStorageSync API is running in non browser environments')
return
}
let obj = {}

@@ -32,2 +40,6 @@

function getStorage (options = {}) {
if (!isBrowser) {
throwSSRWarning('getStorage API is running in non browser environments')
return
}
const { key, success, fail, complete } = options

@@ -48,2 +60,6 @@ const { result, data } = getItem(key)

function getStorageSync (key) {
if (!isBrowser) {
throwSSRWarning('getStorageSync API is running in non browser environments')
return
}
const res = getItem(key)

@@ -70,2 +86,6 @@ if (res.result) return res.data

function getStorageInfo (options = {}) {
if (!isBrowser) {
throwSSRWarning('getStorageInfo API is running in non browser environments')
return
}
const { success, fail, complete } = options

@@ -87,2 +107,6 @@

function getStorageInfoSync () {
if (!isBrowser) {
throwSSRWarning('getStorageInfoSync API is running in non browser environments')
return
}
return {

@@ -96,2 +120,6 @@ keys: Object.keys(window.localStorage),

function removeStorage (options = { key: '' }) {
if (!isBrowser) {
throwSSRWarning('removeStorage API is running in non browser environments')
return
}
const { key, success, fail, complete } = options

@@ -113,2 +141,6 @@

function removeStorageSync (key) {
if (!isBrowser) {
throwSSRWarning('getStorageInfoSync API is running in non browser environments')
return
}
window.localStorage.removeItem(key)

@@ -118,2 +150,6 @@ }

function clearStorage (options = {}) {
if (!isBrowser) {
throwSSRWarning('clearStorage API is running in non browser environments')
return
}
const { success, fail, complete } = options

@@ -135,2 +171,6 @@

function clearStorageSync () {
if (!isBrowser) {
throwSSRWarning('clearStorageSync API is running in non browser environments')
return
}
window.localStorage.clear()

@@ -137,0 +177,0 @@ }

@@ -1,4 +0,8 @@

import { webHandleSuccess } from '../../../common/js'
import { isBrowser, throwSSRWarning, webHandleSuccess } from '../../../common/js'
function getSystemInfoSync () {
if (!isBrowser) {
throwSSRWarning('getSystemInfoSync API is running in non browser environments')
return
}
const ua = navigator.userAgent.split('(')[1].split(')')[0]

@@ -69,2 +73,6 @@ const phones = new Map([

function getSystemInfo (options = {}) {
if (!isBrowser) {
throwSSRWarning('getSystemInfo API is running in non browser environments')
return
}
const info = getSystemInfoSync()

@@ -71,0 +79,0 @@ const res = Object.assign({ errMsg: 'getSystemInfo:ok' }, info)

import Toast from './Toast'
import { isBrowser, throwSSRWarning } from '../../../common/js'

@@ -6,2 +7,6 @@ let toast = null

function showToast (options = { title: '' }) {
if (!isBrowser) {
throwSSRWarning('showToast API is running in non browser environments')
return
}
if (!toast) { toast = new Toast() }

@@ -17,2 +22,6 @@ return toast.show(options, 'toast')

function showLoading (options = { title: '' }) {
if (!isBrowser) {
throwSSRWarning('showLoading API is running in non browser environments')
return
}
if (!toast) { toast = new Toast() }

@@ -19,0 +28,0 @@ return toast.show(Object.assign({

@@ -0,3 +1,9 @@

import { isBrowser, throwSSRWarning } from '../../../common/js'
const allowPlaybackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0]
export const createVideoContext = (id, context) => {
if (!isBrowser) {
throwSSRWarning('createVideoContext API is running in non browser environments')
return
}
if (!id) {

@@ -4,0 +10,0 @@ throw new Error('id为必传参数')

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