mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: eslint cleanup (#10160)
This commit is contained in:
@@ -159,11 +159,11 @@ export function debounce(fn: any, delay = 300) {
|
||||
};
|
||||
}
|
||||
|
||||
export function throttle(fn: any, delay = 300) {
|
||||
export function throttle(fn: Function, delay = 300) {
|
||||
let waiting = false;
|
||||
return function () {
|
||||
return function (...args) {
|
||||
if (!waiting) {
|
||||
fn.apply(this, arguments);
|
||||
fn.apply(this, args);
|
||||
waiting = true;
|
||||
setTimeout(function () {
|
||||
waiting = false;
|
||||
|
||||
@@ -34,9 +34,10 @@ export function dataDeserialize(nativeData?: any) {
|
||||
}
|
||||
case 'org.json.JSONObject': {
|
||||
store = {};
|
||||
let i = nativeData.keys();
|
||||
const i = nativeData.keys();
|
||||
let key;
|
||||
while (i.hasNext()) {
|
||||
let key = i.next();
|
||||
key = i.next();
|
||||
store[key] = dataDeserialize(nativeData.get(key));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -36,8 +36,8 @@ export function dataDeserialize(nativeData?: any) {
|
||||
case 'NSNull':
|
||||
return null;
|
||||
case 'NSMutableDictionary':
|
||||
case 'NSDictionary':
|
||||
let obj = {};
|
||||
case 'NSDictionary': {
|
||||
const obj = {};
|
||||
const length = nativeData.count;
|
||||
const keysArray = nativeData.allKeys as NSArray<any>;
|
||||
for (let i = 0; i < length; i++) {
|
||||
@@ -45,14 +45,16 @@ export function dataDeserialize(nativeData?: any) {
|
||||
obj[nativeKey] = dataDeserialize(nativeData.objectForKey(nativeKey));
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
case 'NSMutableArray':
|
||||
case 'NSArray':
|
||||
let array = [];
|
||||
case 'NSArray': {
|
||||
const array = [];
|
||||
const len = nativeData.count;
|
||||
for (let i = 0; i < len; i++) {
|
||||
array[i] = dataDeserialize(nativeData.objectAtIndex(i));
|
||||
}
|
||||
return array;
|
||||
}
|
||||
default:
|
||||
return nativeData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user