diff --git a/src/core/service/api/context/create-map-context.js b/src/core/service/api/context/create-map-context.js index 74dfd64cafead80afef359c0719daf128e18c49d..466de917f9e989e99662c135f875d2534d49c008 100644 --- a/src/core/service/api/context/create-map-context.js +++ b/src/core/service/api/context/create-map-context.js @@ -18,7 +18,7 @@ UniServiceJSBridge.subscribe('onMapMethodCallback', ({ callback.invoke(callbackId, data) }) -const methods = ['getCenterLocation', 'getScale', 'getRegion'] +const methods = ['getCenterLocation', 'getScale', 'getRegion', 'includePoints', 'translateMarker'] export class MapContext { constructor (id, pageVm) { @@ -29,14 +29,6 @@ export class MapContext { moveToLocation () { operateMapPlayer(this.id, this.pageVm, 'moveToLocation') } - - includePoints (args) { - operateMapPlayer(this.id, this.pageVm, 'includePoints', args) - } - - translateMarker (args) { - operateMapPlayer(this.id, this.pageVm, 'translateMarker', args) - } } MapContext.prototype.$getAppMap = function () { @@ -44,11 +36,9 @@ MapContext.prototype.$getAppMap = function () { } methods.forEach(function (method) { - MapContext.prototype[method] = callback.warp(function (options, callbackId) { - operateMapPlayer(this.id, this.pageVm, method, { - options, - callbackId - }) + MapContext.prototype[method] = callback.warp(function (options, callbackId) { + options.callbackId = callbackId + operateMapPlayer(this.id, this.pageVm, method, options) }) }) diff --git a/src/platforms/app-plus/service/framework/app.js b/src/platforms/app-plus/service/framework/app.js index a46c88f01dd0bab357abb561918b3223716621ce..1981796091fd3cb9b5ddee8548e16c49d7877087 100644 --- a/src/platforms/app-plus/service/framework/app.js +++ b/src/platforms/app-plus/service/framework/app.js @@ -2,7 +2,11 @@ import { callAppHook } from 'uni-core/service/plugins/util' -import initOn from 'uni-core/service/bridge/on' +import initOn from 'uni-core/service/bridge/on' + +import { + requireNativePlugin +} from '../bridge' import { NETWORK_TYPES @@ -54,7 +58,8 @@ export function getApp ({ ) } -function initGlobalListeners () { +function initGlobalListeners () { + const globalEvent = requireNativePlugin('globalEvent') const emit = UniServiceJSBridge.emit // splashclosed 时开始监听 backbutton @@ -84,7 +89,7 @@ function initGlobalListeners () { }) }) - plus.globalEvent.addEventListener('uistylechange', function (event) { + globalEvent.addEventListener('uistylechange', function (event) { publish('onUIStyleChange', { style: event.uistyle }) diff --git a/src/shared/callback.js b/src/shared/callback.js index 6f141cab8c122213bad9e396906c68ff752fce28..84ea60eecb7c59de81dab5fb0d8008585518c772 100644 --- a/src/shared/callback.js +++ b/src/shared/callback.js @@ -10,9 +10,10 @@ function warp (fn) { complete: options.complete } const data = Object.assign({}, options) - delete data.success - delete data.fail - delete data.complete + // TODO 下版重构 nvue h5 callback + // delete data.success + // delete data.fail + // delete data.complete const res = fn.bind(this)(data, callbackId) if (res) { invoke(callbackId, res)