From 7b34994df7339c2d6a976c5c76b0d4bac5ea1418 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Wed, 18 Apr 2018 19:59:27 +0800 Subject: [PATCH] JS Interface --- libs/utils.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libs/utils.js b/libs/utils.js index 67f3022b..fcc6a561 100644 --- a/libs/utils.js +++ b/libs/utils.js @@ -285,6 +285,14 @@ utils.prototype.isset = function (val) { ////// 读取一个本地文件内容 ////// utils.prototype.readFile = function (success, error, readType) { + core.platform.successCallback = success; + core.platform.errorCallback = error; + + if (core.isset(window.jsinterface)) { + window.jsinterface.readFile(); + return; + } + // step 0: 不为http/https,直接不支持 if (!core.platform.isOnline) { alert("离线状态下不支持文件读取!"); @@ -409,6 +417,12 @@ utils.prototype.download = function (filename, content) { ////// 复制一段内容到剪切板 ////// utils.prototype.copy = function (data) { + + if (core.isset(window.jsinterface)) { + window.jsinterface.copy(filename, content); + return true; + } + if (!core.platform.supportCopy) return false; var textArea = document.createElement("textarea");