feat: add DoricDevAssetsLoader in dev mode

This commit is contained in:
pengfei.zhou
2021-12-07 18:53:43 +08:00
committed by osborn
parent 1ba4336857
commit 7b44801b17
5 changed files with 66 additions and 0 deletions

View File

@@ -70,6 +70,8 @@ public class DoricDev {
DoricSingleton.getInstance().getNativeDriver().getRegistry().registerMonitor(new DoricDevMonitor());
DoricSingleton.getInstance().getNativeDriver().getRegistry().setGlobalPerformanceAnchorHook(new DoricDevPerformanceAnchorHook());
DoricSingleton.getInstance().getNativeDriver().getRegistry().registerNativePlugin(DoricDevkitPlugin.class);
//Replace loader
DoricSingleton.getInstance().getNativeDriver().getRegistry().getResourceManager().registerLoader(new DoricDevAssetsLoader());
}
public static DoricDev getInstance() {

View File

@@ -0,0 +1,37 @@
/*
* Copyright [2021] [Doric.Pub]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package pub.doric.devkit;
import pub.doric.DoricContext;
import pub.doric.resource.DoricAssetsLoader;
import pub.doric.resource.DoricAssetsResource;
import pub.doric.resource.DoricResource;
/**
* @Description: Load assets in dev mode
* @Author: pengfei.zhou
* @CreateDate: 2021/12/7
*/
public class DoricDevAssetsLoader extends DoricAssetsLoader {
@Override
public DoricResource load(DoricContext doricContext, String identifier) {
if (DoricDev.getInstance().isInDevMode()) {
}
return new DoricAssetsResource(doricContext, "assets/" + identifier);
}
}