提交 76ce4b88 编写于 作者: Q qiang

fix(App): openDocument callback

上级 2ed91b13
......@@ -5672,12 +5672,8 @@ var serviceContext = (function (vue) {
}, GetFileInfoProtocol, GetFileInfoOptions);
const openDocument = defineAsyncApi(API_OPEN_DOCUMENT, ({ filePath, fileType }, { resolve, reject }) => {
plus.io.resolveLocalFileSystemURL(getRealPath(filePath), (entry) => {
plus.runtime.openFile(getRealPath(filePath));
resolve();
}, (err) => {
reject('openDocument:fail ' + err.message);
});
const errorCallback = warpPlusErrorCallback(reject);
plus.runtime.openFile(getRealPath(filePath), undefined, errorCallback, resolve);
}, OpenDocumentProtocol, OpenDocumentOptions);
function getFileName(path) {
......
......@@ -5,20 +5,18 @@ import {
OpenDocumentProtocol,
OpenDocumentOptions,
} from '@dcloudio/uni-api'
import { warpPlusErrorCallback } from '../../../helpers/plus'
import { getRealPath } from '../../../platform/getRealPath'
export const openDocument = defineAsyncApi<API_TYPE_OPEN_DOCUMENT>(
API_OPEN_DOCUMENT,
({ filePath, fileType }, { resolve, reject }) => {
plus.io.resolveLocalFileSystemURL(
const errorCallback = warpPlusErrorCallback(reject)
plus.runtime.openFile(
getRealPath(filePath),
(entry) => {
plus.runtime.openFile(getRealPath(filePath))
resolve()
},
(err) => {
reject('openDocument:fail ' + err.message)
}
undefined,
errorCallback,
resolve
)
},
OpenDocumentProtocol,
......
......@@ -922,10 +922,10 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@dcloudio/types@^2.4.5":
version "2.4.5"
resolved "https://registry.yarnpkg.com/@dcloudio/types/-/types-2.4.5.tgz#3ead18599a6da0052afb814b522bc007043d814c"
integrity sha512-6PUP4D4PZgm5Zc7hAegNZZreJN6D9VK8bEp/oHG3tevVJ0w9+C/9PBgcX1kStxIwqYcfR0dv8jTyjG08BF185Q==
"@dcloudio/types@^2.4.6":
version "2.4.6"
resolved "https://registry.yarnpkg.com/@dcloudio/types/-/types-2.4.6.tgz#cf4492885b292648e8d3e51c268e5e35376cd9f6"
integrity sha512-wNyfOBEGfAklzDe0BjWDGTZNgI+RIRL+9VfKbYcXNUHJwPfo8B70BHnuP+GwNxppjoDodI3v31eU8xpJEFqeQw==
"@eslint/eslintrc@^0.4.3":
version "0.4.3"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册