当前位置: 首页>>代码示例>>Java>>正文


Java JsMethod类代码示例

本文整理汇总了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;
}
 
开发者ID:timofeevda,项目名称:gwt-rxjs-jsinterop,代码行数:11,代码来源:TestsContainer.java

示例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;
}
 
开发者ID:timofeevda,项目名称:gwt-rxjs-jsinterop,代码行数:15,代码来源:TestsContainer.java

示例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;
}
 
开发者ID:timofeevda,项目名称:gwt-rxjs-jsinterop,代码行数:7,代码来源:TestsContainer.java

示例4: hashCode_

import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod(name = "hashCode")
public native double hashCode_();
 
开发者ID:google,项目名称:jsinterop-generator,代码行数:3,代码来源:SimpleClass.java

示例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;
}
 
开发者ID:timofeevda,项目名称:gwt-rxjs-jsinterop,代码行数:8,代码来源:TestsContainer.java

示例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();
}
 
开发者ID:google,项目名称:jsinterop-base,代码行数:12,代码来源:AnyOptimizationTest.java

示例7: stringIsNullOrEmpty

import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod
static native boolean stringIsNullOrEmpty(@Nullable String string) /*-{
  return !string;
}-*/;
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:5,代码来源:Platform.java

示例8: user

import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod
public static native void user(UserParams data);
 
开发者ID:xemantic,项目名称:github-users-web,代码行数:3,代码来源:Templates.java

示例9: header

import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod
public static native void header();
 
开发者ID:xemantic,项目名称:github-users-web,代码行数:3,代码来源:Templates.java

示例10: attachTo

import jsinterop.annotations.JsMethod; //导入依赖的package包/类
@JsMethod
public static native void attachTo(Element element);
 
开发者ID:xemantic,项目名称:github-users-web,代码行数:3,代码来源:MDCRipple.java

示例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;
}
 
开发者ID:timofeevda,项目名称:gwt-rxjs-jsinterop,代码行数:7,代码来源:TestsContainer.java

示例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;
}
 
开发者ID:timofeevda,项目名称:gwt-rxjs-jsinterop,代码行数:7,代码来源:TestsContainer.java

示例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;
}
 
开发者ID:timofeevda,项目名称:gwt-rxjs-jsinterop,代码行数:7,代码来源:TestsContainer.java

示例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;
}
 
开发者ID:timofeevda,项目名称:gwt-rxjs-jsinterop,代码行数:7,代码来源:TestsContainer.java

示例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;
}
 
开发者ID:timofeevda,项目名称:gwt-rxjs-jsinterop,代码行数:7,代码来源:TestsContainer.java


注:本文中的jsinterop.annotations.JsMethod类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。