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

38. JS sdk 涉及点 #38

Open
ly525 opened this issue Aug 11, 2017 · 0 comments
Open

38. JS sdk 涉及点 #38

ly525 opened this issue Aug 11, 2017 · 0 comments

Comments

@ly525
Copy link
Owner

ly525 commented Aug 11, 2017

  1. 通过JS动态引入的方式加载的CSS文件总是异步的,所以不会阻塞其他文件的风险
  2. 重复加载问题: 提供给publisher的代码,不必再引入多个脚本引入多个脚本来渲染组件。但是很多时候大家都用复制粘贴来解决问题时,publisher还是会这么干,因此脚本有可能会重复执行。如果不希望二次执行,可以在脚本执行时创建一个标识符,比如window[xxxx] = 1从而让代码在二次执行的时候提前退出。判断页面上广告位数量>0的时候才去加载数据。
  3. 使用throttle 解决滚动时候页面抖动问题
  4. 判断元素是否出现在滚动区域
  5. 如果元素出现在滚动区域,判断图片是否有lazy_src属性,使用图片懒加载。

正则系列

  1. trim => return str.replace(/^[\s\xa0]+|[\s\xa0]+$/g, "")
@ly525 ly525 added CSS and removed CSS labels Jul 12, 2018
@ly525 ly525 added this to 鲁班H5 中的应用 in 4.1 技术落地<正则表达式> May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

1 participant