Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design Notes #1

Open
harttle opened this issue Apr 25, 2018 · 3 comments
Open

Design Notes #1

harttle opened this issue Apr 25, 2018 · 3 comments

Comments

@harttle
Copy link
Collaborator

harttle commented Apr 25, 2018

这里描述 user-agent 的一些设计思路,有变更应该随时评论或更新:

  • 不复用其他工具,比如 fex-team/ua-device。主要考虑的原因是 1)非 AMD 入口,在搜索不可直接用(当然可以包装)2)接口风格与搜索业务使用方式不符(见下文)。
  • 主要提供断言,而不是返回浏览器信息。例如设计为 .isChrome() 而不是 .getBrowser() === 'chrome'。由于 1)在搜索业务中绝大多数场景是判定(是/否)某个浏览器,而非获取浏览器信息。2)目前搜索仍然是弱类型的JS源码,返回信息判等容易出错。
@oott123
Copy link
Collaborator

oott123 commented Jul 2, 2018

关于版本判断:

现有的接口,返回版本号数组,诸如:[1, 2, 3]。

虽然相对而言容易比较,但是否应当提供版本比较的工具?是否应当独立成工具库?

@pearlwang1106
Copy link
Collaborator

单独发了一个版本判断的包:versions-compare

目前只支持 整数、字符串、数组(正序和逆序)几种情况,并且只有两个版本是同一个类型才可以,感觉可以满足现有需求

有问题可直接优化

@oott123
Copy link
Collaborator

oott123 commented Jul 7, 2018

酷炫。

@harttle harttle changed the title 接口设计记录 Design Notes Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants