mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-30 22:12:42 +08:00
Resubmit: [react_native] WebWorkers: Add JSLoader API for loading script from assets with AssetLoader reference
Summary: public Adds the ability to load files from assets without threading through an AssetManager. After the bridge is unforked, we should move to passing through an Environment object instead. Resubmit: previous version was reverted due to adsmanager crash Reviewed By: foghina Differential Revision: D2802899 fb-gh-sync-id: 3d850256fc22f7e9eb21fa71f6adb09cacc839c4
This commit is contained in:
committed by
facebook-github-bot-9
parent
17df595e32
commit
1bfd267acb
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package com.facebook.react.common;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
/**
|
||||
* Holds the current Application Object.
|
||||
*
|
||||
* TODO(9577825): This is a bad pattern, we should thread through an Environment object instead.
|
||||
* Remove once bridge is unforked.
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Deprecated
|
||||
public class ApplicationHolder {
|
||||
|
||||
private static Application sApplication;
|
||||
|
||||
public static void setApplication(Application application) {
|
||||
sApplication = application;
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
public static Application getApplication() {
|
||||
return Assertions.assertNotNull(sApplication);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user