Comments (1)
@antty 谢谢你的关注,就你抛出的问题我说一下我的理解吧:
1.1 网络请求的预加载是一个比较常见的使用场景,从它的工作原理介绍可以看到,主要是将UI初始化和网络请求从串行转化为并行,UI比较复杂的页面其初始化时间会比较长,这种场景下,预加载能缩短用户在页面打开时的等待时间。
1.2 预加载的时机可根据业务特性继续往前延伸,比如,一般应用的Splash界面之后必定会跳到主页,而主页面的网络请求往往很多,这时候就可以在Splash页面开启时就预加载主页面中的网络请求
1.3 预加载功能不仅仅能用来进行网络请求,当你发现有耗时操作增加了用户从页面打开到可操作(或内容可见)的时长,但这些操作是必须提前完成的,这时就可以考虑使用预加载来进行优化。例如:文件I/O、网络请求、数据库操作、图片加载等等
- 关于业务隔离:数据的加载(DataLoader)和数据的读取(DataListener)应该内聚在同一个模块内部,通过服务暴露的形式提供给外部调用。接口的维护完全在模块内部进行维护,只不过给外部留了一个开启预加载的口子。 尤其适合组件化开发环境下使用,例如CC。
补充一条: 使用PreLoader能更有利于将数据的加载和数据的使用进行分离(数据的归数据,业务的归业务)
以上!
from preloader.
Related Issues (12)
- 请求数据如何返回 HOT 1
- 刷新API失效 HOT 2
- 页面重新创建找不到preLoadId对应的Worker
- 泛型中可以传递webview实现提前加载吗?
- Web Media Share
- Support real time monitor or not?like stick broadcast HOT 1
- 关于worker线程池的问题 HOT 2
- Can't create handler inside thread that has not called Looper.prepare() HOT 1
- 回调中数据太多导致崩溃 HOT 1
- 异步加载数据传值 HOT 1
- 异步加载数据传值 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from preloader.