public class JSUtil
extends java.lang.Object
Description:JS相关工具方法
限定符和类型 | 字段和说明 |
---|---|
static int |
CLASS_NOT_FOUND_EXCEPTION |
static java.lang.String |
COMMA |
static int |
ERROR |
static int |
ILLEGAL_ACCESS_EXCEPTION |
static int |
INSTANTIATION_EXCEPTION |
static int |
INVALID_ACTION |
static int |
IO_EXCEPTION |
static int |
JSON_EXCEPTION |
static int |
MALFORMED_URL_EXCEPTION |
static int |
NO_RESULT |
static int |
OK |
static java.lang.String |
QUOTE
字符串内部的"字符需要转义
|
构造器和说明 |
---|
JSUtil() |
限定符和类型 | 方法和说明 |
---|---|
static java.lang.String |
arrayList2JsStringArray(java.util.ArrayList<java.lang.String> arr)
转换ArrayList
|
static void |
broadcastWebviewEvent(IWebview pWebViewImpl,
java.lang.String pWebviewId,
java.lang.String evtType,
java.lang.String msg) |
static boolean |
checkOperateDirErrorAndCallback(IWebview view,
java.lang.String callbackId,
java.lang.String checkPath)
检测是否操作了_www目录,如果操作了_www目录则回调js函数
|
static java.lang.String |
consoleTest(java.lang.String msg) |
static void |
excCallbackError(IWebview pWebViewImpl,
java.lang.String pCallbackId,
java.lang.String pMessage)
已过时。
|
static void |
excCallbackError(IWebview pWebViewImpl,
java.lang.String pCallbackId,
java.lang.String pMessage,
boolean pIsJson)
已过时。
|
static void |
excCallbackSuccess(IWebview pWebViewImpl,
java.lang.String pCallbackId,
java.lang.String pMessage)
已过时。
|
static void |
excCallbackSuccess(IWebview pWebViewImpl,
java.lang.String pCallbackId,
java.lang.String pMessage,
boolean pIsJson)
已过时。
|
static void |
excCallbackSuccess(IWebview pWebViewImpl,
java.lang.String pCallbackId,
java.lang.String pMessage,
boolean pIsJson,
boolean pKeepCallback)
已过时。
|
static void |
excDownloadCallBack(IWebview pWebViewImpl,
java.lang.String pMessage,
java.lang.String pJSID)
已过时。
|
static void |
excUploadCallBack(IWebview pWebViewImpl,
java.lang.String pMessage,
java.lang.String pJSID)
已过时。
|
static void |
execCallback(IWebview pWebViewImpl,
java.lang.String pCallbackId,
double pMessage,
int pStatus,
boolean pKeepCallback) |
static void |
execCallback(IWebview pWebViewImpl,
java.lang.String pCallbackId,
JSONArray pMessage,
int pStatus,
boolean pKeepCallback) |
static void |
execCallback(IWebview pWebViewImpl,
java.lang.String pCallbackId,
JSONObject pMessage,
int pStatus,
boolean pKeepCallback) |
static void |
execCallback(IWebview pWebViewImpl,
java.lang.String pCallbackId,
java.lang.String pMessage,
int pStatus,
boolean pKeepCallback) |
static void |
execCallback(IWebview pWebViewImpl,
java.lang.String pCallbackId,
java.lang.String pMessage,
int pStatus,
boolean isNotString,
boolean pKeepCallback)
已过时。
|
static java.lang.String[] |
jsonArrayToStringArr(JSONArray pJsonArray)
Description:由jsonArray获取String数组
|
static java.lang.String |
toJsResponseText(java.lang.String pResponseText)
Description:格式化ResponseText
|
static java.lang.String |
wrapJsVar(double value)
封装native层返回值
|
static java.lang.String |
wrapJsVar(JSONArray value)
封装native层返回值
|
static java.lang.String |
wrapJsVar(JSONObject value)
封装native层返回值
|
static java.lang.String |
wrapJsVar(java.lang.String value,
boolean isString)
已过时。
|
public static final java.lang.String QUOTE
public static final java.lang.String COMMA
public static int NO_RESULT
public static int OK
public static int CLASS_NOT_FOUND_EXCEPTION
public static int ILLEGAL_ACCESS_EXCEPTION
public static int INSTANTIATION_EXCEPTION
public static int MALFORMED_URL_EXCEPTION
public static int IO_EXCEPTION
public static int INVALID_ACTION
public static int JSON_EXCEPTION
public static int ERROR
public static java.lang.String[] jsonArrayToStringArr(JSONArray pJsonArray) throws JSONException
pJsonArray
- JSONException
- ModifiedLog:
Log ID: 1.0 (Log编号 依次递增) Modified By: cuidengfeng Email:cuidengfeng@dcloud.io at 2013-1-9 下午5:39:36
public static java.lang.String wrapJsVar(double value)
value
- 返回值public static java.lang.String wrapJsVar(JSONArray value)
value
- 返回值public static java.lang.String wrapJsVar(JSONObject value)
value
- 返回值public static java.lang.String consoleTest(java.lang.String msg)
public static java.lang.String arrayList2JsStringArray(java.util.ArrayList<java.lang.String> arr)
arr
- 要转换的native层string数组public static void execCallback(IWebview pWebViewImpl, java.lang.String pCallbackId, java.lang.String pMessage, int pStatus, boolean pKeepCallback)
public static void execCallback(IWebview pWebViewImpl, java.lang.String pCallbackId, double pMessage, int pStatus, boolean pKeepCallback)
public static void execCallback(IWebview pWebViewImpl, java.lang.String pCallbackId, JSONArray pMessage, int pStatus, boolean pKeepCallback)
public static void execCallback(IWebview pWebViewImpl, java.lang.String pCallbackId, JSONObject pMessage, int pStatus, boolean pKeepCallback)
public static void broadcastWebviewEvent(IWebview pWebViewImpl, java.lang.String pWebviewId, java.lang.String evtType, java.lang.String msg)
public static boolean checkOperateDirErrorAndCallback(IWebview view, java.lang.String callbackId, java.lang.String checkPath)
view
- 当前回调所需要的IWebview句柄callbackId
- 回调函数的在js层的唯一标示checkPath
- 要检测是路径public static java.lang.String toJsResponseText(java.lang.String pResponseText)
pResponseText
- ModifiedLog:
Log ID: 1.0 (Log编号 依次递增) Modified By: cuidengfeng Email:cuidengfeng@dcloud.io at 2013-4-9 下午4:20:10
@Deprecated public static void execCallback(IWebview pWebViewImpl, java.lang.String pCallbackId, java.lang.String pMessage, int pStatus, boolean isNotString, boolean pKeepCallback)
@Deprecated public static void excCallbackSuccess(IWebview pWebViewImpl, java.lang.String pCallbackId, java.lang.String pMessage)
pWebViewImpl
- pCallbackId
- pMessage
- ModifiedLog:
Log ID: 1.0 (Log编号 依次递增) Modified By: cuidengfeng Email:cuidengfeng@dcloud.io at 2013-2-18 上午11:51:35
@Deprecated public static void excCallbackSuccess(IWebview pWebViewImpl, java.lang.String pCallbackId, java.lang.String pMessage, boolean pIsJson)
pWebViewImpl
- pCallbackId
- pMessage
- pIsJson
- 说明@pMessage是否为json格式
ModifiedLog:
Log ID: 1.0 (Log编号 依次递增) Modified By: cuidengfeng Email:cuidengfeng@dcloud.io at 2013-2-18 上午11:51:35
@Deprecated public static void excCallbackSuccess(IWebview pWebViewImpl, java.lang.String pCallbackId, java.lang.String pMessage, boolean pIsJson, boolean pKeepCallback)
pWebViewImpl
- pCallbackId
- pMessage
- pIsJson
- 说明@pMessage是否为json格式pIsJson
- 说明@pKeepCallback是否需要保存回调
ModifiedLog:
Log ID: 1.0 (Log编号 依次递增) Modified By: cuidengfeng Email:cuidengfeng@dcloud.io at 2013-2-18 上午11:51:35
@Deprecated public static void excCallbackError(IWebview pWebViewImpl, java.lang.String pCallbackId, java.lang.String pMessage)
pWebViewImpl
- pCallbackId
- pMessage
- 说明@pMessage是否为json格式
ModifiedLog:
Log ID: 1.0 (Log编号 依次递增) Modified By: cuidengfeng Email:cuidengfeng@dcloud.io at 2013-2-18 上午11:52:13
@Deprecated public static void excCallbackError(IWebview pWebViewImpl, java.lang.String pCallbackId, java.lang.String pMessage, boolean pIsJson)
pWebViewImpl
- pCallbackId
- pMessage
- pIsJson
- @Deprecated public static void excDownloadCallBack(IWebview pWebViewImpl, java.lang.String pMessage, java.lang.String pJSID)
pWebViewImpl
- pMessage
- downloadTask 返回值pJSID
- ModifiedLog:
Log ID: 1.0 (Log编号 依次递增) Modified By: cuidengfeng Email:cuidengfeng@dcloud.io at 2013-2-19 下午3:35:26
@Deprecated public static void excUploadCallBack(IWebview pWebViewImpl, java.lang.String pMessage, java.lang.String pJSID)
pWebViewImpl
- pMessage
- downloadTask 返回值pJSID
- ModifiedLog:
Log ID: 1.0 (Log编号 依次递增) Modified By: cuidengfeng Email:cuidengfeng@dcloud.io at 2013-2-19 下午3:35:26
@Deprecated public static java.lang.String wrapJsVar(java.lang.String value, boolean isString)
value
- 返回值isString
- 返回值是否为String类型