diff --git a/src/core/service/api/media/preview-image.js b/src/core/service/api/media/preview-image.js new file mode 100644 index 0000000000000000000000000000000000000000..ddda86e817ae7f1fd90670f6e275fd45ea1693b0 --- /dev/null +++ b/src/core/service/api/media/preview-image.js @@ -0,0 +1,27 @@ +import { + onMethod, + invokeMethod +} from '../../platform' + +const longPressActionsCallbackId = 'longPressActionsCallback' + +let longPressActions = {} + +onMethod(longPressActionsCallbackId, function (res) { + const errMsg = res.errMsg || '' + if (new RegExp('\\:\\s*fail').test(errMsg)) { + longPressActions.fail && longPressActions.fail(res) + } else { + longPressActions.success && longPressActions.success(res) + } + longPressActions.complete && longPressActions.complete(res) +}) + +export function previewImage (args = {}) { + longPressActions = args.longPressActions || {} + if (longPressActions.success || longPressActions.fail || longPressActions.complete) { + longPressActions.callbackId = longPressActionsCallbackId + } + + return invokeMethod('previewImagePlus', args) +} diff --git a/src/platforms/app-plus/service/api/media/preview-image.js b/src/platforms/app-plus/service/api/media/preview-image.js index 141e06c16d668d99c615ce2764bb2ae4aa458111..27e40fa6e9236ec0e6467e2ecd5b0fa6dee2f514 100644 --- a/src/platforms/app-plus/service/api/media/preview-image.js +++ b/src/platforms/app-plus/service/api/media/preview-image.js @@ -6,7 +6,7 @@ import { publish } from '../../bridge' -export function previewImage ({ +export function previewImagePlus ({ current = 0, background = '#000000', indicator = 'number',