fix(selector): UiObjectCollection.find() conflicts with Array.find()

This commit is contained in:
hyb1996
2018-04-07 14:03:14 +08:00
parent af8823b10f
commit 16692dadf3
2 changed files with 2 additions and 23 deletions

View File

@@ -39,7 +39,7 @@ runtime.init();
arr.push(list.get(i)); arr.push(list.get(i));
} }
for(var key in list){ for(var key in list){
if(arr[key]) if(typeof(key) == 'number')
continue; continue;
var v = list[key]; var v = list[key];
if(typeof(v) == 'function'){ if(typeof(v) == 'function'){
@@ -104,7 +104,7 @@ runtime.init();
importClass(android.view.KeyEvent); importClass(android.view.KeyEvent);
importClass(com.stardust.autojs.core.util.Shell); importClass(com.stardust.autojs.core.util.Shell);
importClass(android.graphics.Paint); importClass(android.graphics.Paint);
importClass(android.graphics.Canvas); Canvas = com.stardust.autojs.core.graphics.ScriptCanvas;
//重定向require以便支持相对路径 //重定向require以便支持相对路径
(function(){ (function(){

View File

@@ -165,8 +165,6 @@ public class RhinoJavaScriptEngine extends JavaScriptEngine {
private class WrapFactory extends org.mozilla.javascript.WrapFactory { private class WrapFactory extends org.mozilla.javascript.WrapFactory {
private ConcurrentHashMap<Class, NativeJavaClassWithPrototype> mJavaClasses = new ConcurrentHashMap<>();
@Override @Override
public Object wrap(Context cx, Scriptable scope, Object obj, Class<?> staticType) { public Object wrap(Context cx, Scriptable scope, Object obj, Class<?> staticType) {
if (obj instanceof String) { if (obj instanceof String) {
@@ -177,25 +175,6 @@ public class RhinoJavaScriptEngine extends JavaScriptEngine {
} }
return super.wrap(cx, scope, obj, staticType); return super.wrap(cx, scope, obj, staticType);
} }
@Override
public Scriptable wrapAsJavaObject(Context cx, Scriptable scope, Object javaObject, Class<?> staticType) {
NativeJavaObjectWithPrototype obj = new NativeJavaObjectWithPrototype(scope, javaObject, staticType);
NativeJavaClassWithPrototype clazz = mJavaClasses.get(obj.getClass());
if (clazz == null) {
clazz = (NativeJavaClassWithPrototype) wrapJavaClass(cx, scope, obj.getClass());
}
obj.setPrototype(clazz);
return obj;
}
@Override
public Scriptable wrapJavaClass(Context cx, Scriptable scope, Class<?> javaClass) {
NativeJavaClassWithPrototype clazz = new NativeJavaClassWithPrototype(scope, javaClass);
mJavaClasses.put(javaClass, clazz);
return clazz;
}
} }
private class InterruptibleAndroidContextFactory extends AndroidContextFactory { private class InterruptibleAndroidContextFactory extends AndroidContextFactory {