项目作者: grrr-amsterdam

项目描述 :
DOM ready & document loaded JavaScript listeners
高级语言: JavaScript
项目地址: git://github.com/grrr-amsterdam/ready.git
创建时间: 2019-11-08T09:39:02Z
项目社区:https://github.com/grrr-amsterdam/ready

开源协议:MIT License

下载


Ready

CI

DOM ready & document loaded JavaScript listeners

  • Lightweight (less than 250b minified and gzipped)
  • No dependencies
  • Supports IE 9+

Developed with ❤️ by GRRR

Installation

  1. $ npm install @grrr/ready

Note: depending on your setup additional configuration might be needed, since this package is published with untranspiled JavaScript.

Usage

Import into your main JavaScript file:

  1. import { onDocumentLoaded, onDomReady } from "@grrr/ready";
  2. onDomReady(() => {
  3. // Execute main functions
  4. });
  5. onDocumentLoaded(() => {
  6. // Execute functions after the document has fully loaded
  7. });

DOM ready

The onDomReady function:

Document loaded

The onDocumentLoaded function: