mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
http jsonp support added
This commit is contained in:
@@ -20,6 +20,15 @@ export function copyFrom(source: any, target: any) {
|
||||
}
|
||||
}
|
||||
|
||||
export function parseJSON(source: string): any {
|
||||
var src = source.trim();
|
||||
if (src.lastIndexOf(")") === src.length - 1) {
|
||||
return JSON.parse(src.substring(src.indexOf("(") + 1, src.lastIndexOf(")")));
|
||||
}
|
||||
|
||||
return JSON.parse(src);
|
||||
}
|
||||
|
||||
export module layout {
|
||||
|
||||
var MODE_SHIFT = 30;
|
||||
@@ -39,6 +48,7 @@ export module layout {
|
||||
return "Exact";
|
||||
|
||||
case layout.AT_MOST:
|
||||
|
||||
return "AtMost";
|
||||
|
||||
default:
|
||||
|
||||
6
utils/utils.d.ts
vendored
6
utils/utils.d.ts
vendored
@@ -167,4 +167,10 @@
|
||||
* @param uri The URI.
|
||||
*/
|
||||
export function isDataURI(uri: string): boolean
|
||||
|
||||
/**
|
||||
* Returns object from JSON or JSONP string.
|
||||
* @param source The JSON or JSONP string.
|
||||
*/
|
||||
export function parseJSON(source: string): any
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user