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

@mpxjs/api-proxy

Package Overview
Dependencies
Maintainers
6
Versions
168
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.7.0-beta.1 to 2.7.0-beta.6

5

package.json
{
"name": "@mpxjs/api-proxy",
"version": "2.7.0-beta.1",
"version": "2.7.0-beta.6",
"description": "convert miniprogram API at each end",

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

],
"main": "src/index.js",
"repository": {

@@ -42,3 +43,3 @@ "type": "git",

},
"gitHead": "7f65fd0558d535329892d99ddaeebe675127314b"
"gitHead": "c04233503af0b1c7b4410fd03582d9dd883182d9"
}

10

src/common/js/web.js

@@ -11,5 +11,13 @@ function webHandleSuccess (result, success, complete) {

function isTabBarPage (url, router) {
const tabBarPagesMap = global.__tabBarPagesMap
if (!tabBarPagesMap || !url) return false
const path = router.match(url, router.history.current).path
return !!tabBarPagesMap[path.slice(1)]
}
export {
webHandleSuccess,
webHandleFail
webHandleFail,
isTabBarPage
}

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

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

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

if (router) {
if (isTabBarPage(options.url, router)) {
const res = { errMsg: 'redirectTo:fail can not redirectTo a tabBar page' }
webHandleFail(res, options.fail, options.complete)
return Promise.reject(res)
}
router.__mpxAction = { type: 'redirect' }

@@ -32,2 +37,7 @@ return new Promise((resolve, reject) => {

if (router) {
if (isTabBarPage(options.url, router)) {
const res = { errMsg: 'navigateTo:fail can not navigateTo a tabBar page' }
webHandleFail(res, options.fail, options.complete)
return Promise.reject(res)
}
const eventChannel = new EventChannel()

@@ -76,7 +86,9 @@ router.__mpxAction = {

let reLaunchCount = 0
function reLaunch (options = {}) {
const router = global.__mpxRouter
if (router) {
if (reLaunchCount === 0 && router.currentRoute.query.reLaunchCount) reLaunchCount = router.currentRoute.query.reLaunchCount
const delta = router.stack.length - 1
let reLaunchCount = router.currentRoute.query.reLaunchCount || 0
router.__mpxAction = {

@@ -126,3 +138,3 @@ type: 'reLaunch',

if (toRoute.path !== currentRoute.path) {
if (toRoute.redirectedFrom) {
if (!isTabBarPage(options.url, router)) {
const res = { errMsg: 'switchTab:fail can not switch to no-tabBar page!' }

@@ -129,0 +141,0 @@ webHandleFail(res, options.fail, options.complete)

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