touchui-api
Advanced tools
Comparing version 0.0.2 to 0.0.3
38
api.js
@@ -19,2 +19,8 @@ // 文件临时路径 | ||
} | ||
function isAndroid() { | ||
return !!navigator.userAgent.match(/android/i); | ||
} | ||
function isIos() { | ||
return !!navigator.userAgent.match(/iPhone|iPad|iPod/i); | ||
} | ||
// 通用返回处理 | ||
@@ -62,4 +68,9 @@ function callback(data, successData, failData) { | ||
// 从用户地址转换 | ||
function fromUserPath(path) { | ||
return path.replace('file://', '') | ||
function fromUserPath(path, absolute) { | ||
var path = path.replace('file://', '') | ||
if(!absolute) { | ||
path = plus.io.convertAbsoluteFileSystem(path) | ||
} | ||
return path | ||
} | ||
@@ -72,3 +83,3 @@ // 获取持久存储目录对象 | ||
}, function(error) { | ||
if(error.code === 12) { | ||
if(error.code === isAndroid() ? 12 : 1) { | ||
plus.io.resolveLocalFileSystemURL(BASEPATH, function(entry) { | ||
@@ -372,2 +383,3 @@ entry.getDirectory(SAVEDFILEPATH.replace(BASEPATH, ''), { | ||
api.uploadFile = function(data) { | ||
console.log(data) | ||
var url = data.url | ||
@@ -893,3 +905,3 @@ var filePath = data.filePath | ||
}, function(error) { | ||
if(error.code === 12) { | ||
if(error.code === isAndroid() ? 12 : 1) { | ||
plus.io.resolveLocalFileSystemURL(BASEPATH, function(entry) { | ||
@@ -911,10 +923,12 @@ entry.getDirectory(TEMPFILEPATH.replace(BASEPATH, ''), { | ||
}) | ||
module.exports = api | ||
// 修复console | ||
if(isIos()) { | ||
window.console.log = window.console.warn = window.console.error = function() { | ||
for(var index = 0; index < arguments.length; index++) { | ||
var element = arguments[index]; | ||
console.dir(element) | ||
} | ||
} | ||
} | ||
api.startRecord({ | ||
success: function(res) { | ||
console.log(res) | ||
}, | ||
}) | ||
api.stopRecord() | ||
module.exports = api |
{ | ||
"name": "touchui-api", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "touchui api", | ||
@@ -5,0 +5,0 @@ "main": "api.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29989
11
917