本文整理汇总了Java中jsinterop.annotations.JsMethod类的典型用法代码示例。如果您正苦于以下问题:Java JsMethod类的具体用法?Java JsMethod怎么用?Java JsMethod使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JsMethod类属于jsinterop.annotations包,在下文中一共展示了JsMethod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSubscribers
import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod(name="subscribers")
public boolean testSubscribers() {
Subscriber[] subscribers = new Subscriber[10];
for(int i=0; i < 10; i++) {
final int index = i;
Observable.create((OnSubscribe<String>) subscriber -> subscribers[index] = subscriber).subscribe(s -> {});
}
Arrays.stream(subscribers).forEach(Subscription::unsubscribe);
return true;
}
示例2: testCreateWithAdditionalSubscription
import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod(name = "createWithAdditionalSubscription")
public boolean testCreateWithAdditionalSubscription() {
BooleanHolder teardownTriggered = new BooleanHolder();
StringHolder stringHolder = new StringHolder();
// dummy "observable" implementation, just for API testing
Observable<String> observeStringArray = Observable.create((Subscriber<String> subscriber) -> {
subscriber.next("1");
subscriber.complete();
return subscriber::unsubscribe;
});
Subscription subscription = observeStringArray.subscribe(v -> stringHolder.value += v);
subscription.add(() -> teardownTriggered.value = true);
return teardownTriggered.value;
}
示例3: testLast
import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod(name = "last")
public String testLast() {
final StringHolder sh = new StringHolder();
Observable.of("3", "1", "2","1", "2").first((v,i) -> v.equals("1")).subscribe(v -> sh.value += v);
return sh.value;
}
示例4: hashCode_
import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod(name = "hashCode")
public native double hashCode_();
示例5: testPartition
import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod(name = "partition")
public String testPartition() {
final StringHolder sh = new StringHolder();
Observable<String>[] obs = Observable.of("1", "3").partition(v -> v.equals("3"));
obs[1].subscribe(v -> sh.value += v);
return sh.value;
}
示例6: asPrimitive
import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod @UsedReflectively
private void asPrimitive(String objectField) {
double d = Js.asAny(objectField).asDouble();
float f = Js.asAny(objectField).asFloat();
long l = Js.asAny(objectField).asLong();
int x = Js.asAny(objectField).asInt();
short s = Js.asAny(objectField).asShort();
char c = Js.asAny(objectField).asChar();
byte b = Js.asAny(objectField).asByte();
boolean bool = Js.asAny(objectField).asBoolean();
}
示例7: stringIsNullOrEmpty
import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod
static native boolean stringIsNullOrEmpty(@Nullable String string) /*-{
return !string;
}-*/;
示例8: user
import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod
public static native void user(UserParams data);
示例9: header
import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod
public static native void header();
示例10: attachTo
import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod
public static native void attachTo(Element element);
示例11: testFilterPredicate
import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod(name = "filterPredicate")
public boolean testFilterPredicate() {
final BooleanHolder bh = new BooleanHolder();
Observable.of(false, true).filter(v -> false).subscribe(aBoolean -> bh.value = aBoolean);
return bh.value;
}
示例12: testMergeTwo
import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod(name = "mergeTwo")
public String testMergeTwo() {
final StringHolder sh = new StringHolder();
Observable.mergeStatic(Observable.of("1"), Observable.of("2")).subscribe(v -> sh.value += v);
return sh.value;
}
示例13: testMergeThree
import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod(name = "mergeThree")
public String testMergeThree() {
final StringHolder sh = new StringHolder();
Observable.mergeStatic(Observable.of("1"), Observable.of("2"), Observable.of("3")).subscribe(v -> sh.value += v);
return sh.value;
}
示例14: testDefer
import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod(name = "defer")
public String testDefer() {
final StringHolder sh = new StringHolder();
Observable.defer(() -> Observable.of("1")).subscribe(v -> sh.value += v);
return sh.value;
}
示例15: testRace
import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod(name = "race")
public String testRace() {
final StringHolder sh = new StringHolder();
Observable.race(Observable.of("1"), Observable.of("2")).subscribe(v -> sh.value += v);
return sh.value;
}