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


Java HeadlessJsTaskContext.getInstance方法代码示例

本文整理汇总了Java中com.facebook.react.jstasks.HeadlessJsTaskContext.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java HeadlessJsTaskContext.getInstance方法的具体用法?Java HeadlessJsTaskContext.getInstance怎么用?Java HeadlessJsTaskContext.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.react.jstasks.HeadlessJsTaskContext的用法示例。


在下文中一共展示了HeadlessJsTaskContext.getInstance方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDestroy

import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入方法依赖的package包/类
@Override
public void onDestroy() {
  super.onDestroy();

  if (getReactNativeHost().hasInstance()) {
    ReactInstanceManager reactInstanceManager = getReactNativeHost().getReactInstanceManager();
    ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
    if (reactContext != null) {
      HeadlessJsTaskContext headlessJsTaskContext =
        HeadlessJsTaskContext.getInstance(reactContext);
      headlessJsTaskContext.removeTaskEventListener(this);
    }
  }
  if (sWakeLock != null) {
    sWakeLock.release();
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:18,代码来源:HeadlessJsTaskService.java

示例2: notifyTaskFinished

import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入方法依赖的package包/类
@ReactMethod
public void notifyTaskFinished(int taskId) {
  HeadlessJsTaskContext headlessJsTaskContext =
    HeadlessJsTaskContext.getInstance(getReactApplicationContext());
  if (headlessJsTaskContext.isTaskRunning(taskId)) {
    headlessJsTaskContext.finishTask(taskId);
  } else {
    FLog.w(
      HeadlessJsTaskSupportModule.class,
      "Tried to finish non-active task with id %d. Did it time out?",
      taskId);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:14,代码来源:HeadlessJsTaskSupportModule.java

示例3: initialize

import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入方法依赖的package包/类
@Override
public void initialize() {
  getReactApplicationContext().addLifecycleEventListener(this);
  HeadlessJsTaskContext headlessJsTaskContext =
    HeadlessJsTaskContext.getInstance(getReactApplicationContext());
  headlessJsTaskContext.addTaskEventListener(this);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:8,代码来源:Timing.java

示例4: onHeadlessJsTaskFinish

import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入方法依赖的package包/类
@Override
public void onHeadlessJsTaskFinish(int taskId) {
  HeadlessJsTaskContext headlessJsTaskContext =
    HeadlessJsTaskContext.getInstance(getReactApplicationContext());
  if (!headlessJsTaskContext.hasActiveTasks()) {
    isRunningTasks.set(false);
    clearFrameCallback();
    maybeIdleCallback();
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:11,代码来源:Timing.java

示例5: onCatalystInstanceDestroy

import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入方法依赖的package包/类
@Override
public void onCatalystInstanceDestroy() {
  clearFrameCallback();
  clearChoreographerIdleCallback();
  HeadlessJsTaskContext headlessJsTaskContext =
    HeadlessJsTaskContext.getInstance(getReactApplicationContext());
  headlessJsTaskContext.removeTaskEventListener(this);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:9,代码来源:Timing.java

示例6: clearFrameCallback

import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入方法依赖的package包/类
private void clearFrameCallback() {
  HeadlessJsTaskContext headlessJsTaskContext =
    HeadlessJsTaskContext.getInstance(getReactApplicationContext());
  if (mFrameCallbackPosted && isPaused.get() &&
    !headlessJsTaskContext.hasActiveTasks()) {
    Assertions.assertNotNull(mReactChoreographer).removeFrameCallback(
        ReactChoreographer.CallbackType.TIMERS_EVENTS,
        mTimerFrameCallback);
    mFrameCallbackPosted = false;
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:12,代码来源:Timing.java

示例7: initialize

import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入方法依赖的package包/类
@Override
public void initialize() {
  // Safe to acquire choreographer here, as initialize() is invoked from UI thread.
  mReactChoreographer = ReactChoreographer.getInstance();
  getReactApplicationContext().addLifecycleEventListener(this);
  HeadlessJsTaskContext headlessJsTaskContext =
    HeadlessJsTaskContext.getInstance(getReactApplicationContext());
  headlessJsTaskContext.addTaskEventListener(this);
}
 
开发者ID:Right-Men,项目名称:Ironman,代码行数:10,代码来源:Timing.java

示例8: onHeadlessJsTaskFinish

import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入方法依赖的package包/类
@Override
public void onHeadlessJsTaskFinish(int taskId) {
  HeadlessJsTaskContext headlessJsTaskContext =
    HeadlessJsTaskContext.getInstance(getReactApplicationContext());
  if (!headlessJsTaskContext.hasActiveTasks()) {
    isRunningTasks.set(false);
    clearChoreographerCallback();
    maybeClearChoreographerIdleCallback();
  }
}
 
开发者ID:Right-Men,项目名称:Ironman,代码行数:11,代码来源:Timing.java

示例9: onCatalystInstanceDestroy

import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入方法依赖的package包/类
@Override
public void onCatalystInstanceDestroy() {
  clearChoreographerCallback();
  clearChoreographerIdleCallback();
  HeadlessJsTaskContext headlessJsTaskContext =
    HeadlessJsTaskContext.getInstance(getReactApplicationContext());
  headlessJsTaskContext.removeTaskEventListener(this);
}
 
开发者ID:Right-Men,项目名称:Ironman,代码行数:9,代码来源:Timing.java

示例10: clearChoreographerCallback

import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入方法依赖的package包/类
private void clearChoreographerCallback() {
  HeadlessJsTaskContext headlessJsTaskContext =
    HeadlessJsTaskContext.getInstance(getReactApplicationContext());
  if (mFrameCallbackPosted && isPaused.get() &&
    !headlessJsTaskContext.hasActiveTasks()) {
    Assertions.assertNotNull(mReactChoreographer).removeFrameCallback(
        ReactChoreographer.CallbackType.TIMERS_EVENTS,
        mTimerFrameCallback);
    mFrameCallbackPosted = false;
  }
}
 
开发者ID:Right-Men,项目名称:Ironman,代码行数:12,代码来源:Timing.java

示例11: invokeStartTask

import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入方法依赖的package包/类
private void invokeStartTask(ReactContext reactContext, HeadlessJsTaskConfig taskConfig) {
  HeadlessJsTaskContext headlessJsTaskContext = HeadlessJsTaskContext.getInstance(reactContext);
  headlessJsTaskContext.addTaskEventListener(this);
  int taskId = headlessJsTaskContext.startTask(taskConfig);
  mActiveTasks.add(taskId);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:7,代码来源:HeadlessJsTaskService.java

示例12: notifyTaskFinished

import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入方法依赖的package包/类
@ReactMethod
public void notifyTaskFinished(int taskId) {
  HeadlessJsTaskContext headlessJsTaskContext =
    HeadlessJsTaskContext.getInstance(getReactApplicationContext());
  headlessJsTaskContext.finishTask(taskId);
}
 
开发者ID:Right-Men,项目名称:Ironman,代码行数:7,代码来源:HeadlessJsTaskSupportModule.java

示例13: invokeStartTask

import com.facebook.react.jstasks.HeadlessJsTaskContext; //导入方法依赖的package包/类
private void invokeStartTask(ReactContext reactContext, final HeadlessJsTaskConfig taskConfig) {
    final HeadlessJsTaskContext headlessJsTaskContext = HeadlessJsTaskContext.getInstance(reactContext);
    headlessJsTaskContext.addTaskEventListener(this);

    mActiveTaskContext = headlessJsTaskContext;

    UiThreadUtil.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            int taskId = headlessJsTaskContext.startTask(taskConfig);
        }
    });



}
 
开发者ID:transistorsoft,项目名称:react-native-background-geolocation,代码行数:17,代码来源:RNBackgroundGeolocationEventReceiver.java


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