GoogleChromeLabs / react-adaptive-hooks

Deliver experiences best suited to a user's device and network constraints
Apache License 2.0
5.1k stars 113 forks source link

Improvement #14

Closed natanloterio closed 4 years ago

natanloterio commented 4 years ago

Hi guys, first of all your lib is awesome. And what if it had a interface that automatically inject the right resource? Like in android, you have different paths for different assets, IMG-20191112-WA0016

addyosmani commented 4 years ago

Could you maybe share a link with more detail on how Android handles this? For automatic resource selection without much developer input, we're thinking solving this at the server-side level may make the most sense.

This package won't be looking at that automatic side directly, but longer term we do want to have a solution we can offer developers.

TenviLi commented 4 years ago

我大概知道他的意思了 @addyosmani 拿 屏幕分辨率 举例子,在assets下放置不同分辨率的资源文件(比如mdpi、hdpi 、xhdpi、xxhdpi...),Android 应用会根据当前设备支持的分辨率来自动加载不同的资源文件 当然只是举个例子, @natanloterio 把这个和 网络状况 类比了一下,我也在想,在不同网络状况下(2g, 3g, 4g, slow-2g) 是否可以直接根据 函数名 或者 对象的属性名 再或者 文件命名 或者 文件夹命名 来自动加载不同的组件