Giter Site home page Giter Site logo

tiny-loader.js's Introduction

Tiny-Loader.js

A small loader that load CSS/JS in best way for page performance

如何使用Tiny-Loader

Loader.async: 下载远端js,css文件,异步执行,适用于对执行顺序不重要的js文件

Loader.async(['xxxx.css', 'yyyy.js'])

Loader.sync: 下载远端js,css文件,同步执行,适用于对执行顺序有要求的js文件

Loader.sync(['xxxx.css', 'yyyy.js', 'zzzz.js'])

#####注:#####

  • css加载都是以async方式
  • 会自动判断文件类型,用正确的方式加载文件

为何要使用Tiny-Loader

Tiny-Loader加载器 会在页面'load'事件以后进行静态资源的下载,减少js对页面打开速度的影响,提前'load'事件的触发

Tiny-Loader加载器 可以用在静态资源的按需加载上。在页面中,会有一部分js,css在用户某些操作或者和后端交互以后才需要的,可以用Tiny-Loader做延后加载。在操作或者交互完后,调用Tiny-Loader下载这部分资源,这样可以减少页面初始加载静态资源的文件大小

Tiny-Loader加载器 也可以用在静态资源的预加载上。通过判断用户的访问趋势,在当前页面打开完成后,用Tiny-Loader下载热点静态资源文件,或者接下来页面的静态资源文件。加快后续页面的打开速度。

示例

疑问或问题

有任何疑问或者问题,可以在issue中向我们提出来,我们会第一时间解决。

tiny-loader.js's People

Contributors

pangxie1991 avatar delai avatar

Watchers

James Cloos avatar Jinphen avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.