Neutral, Plus or Minus

    @util.js/jquery

    0.41.1 • Public • Published

    @util.js/jquery

    JavaScript utility methods for jQuery

    NPM Status Travis CI Build Status

    @util.js/jquery is part of Util.js.

    JQueryUtils API

    Kind: global class
    Access: public

    jQueryUtils.loadjQuery(params, [callback]) ⇒ undefined | Promise

    Loads jQuery asynchronously and sends a notification when loading has finished

    Kind: instance method of JQueryUtils
    Returns: undefined | Promise - undefined if a callback is specified or a Promise that returns jQuery once jQuery has finished loading
    Throws:

    • Error If params is undefined, null, or params has an invalid window object

    Access: public

    Param Type Default Description
    params Object
    [params.src] string "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" The jQuery script to load
    params.window Window The browser's window
    [callback] function A callback function that takes two arguments: error and jQuery

    Example

    const jQueryUtils = require("@util.js/jquery");
    jQueryUtils
      .loadjQuery({ window })
      .then(($) => console.log($))
      .catch(console.log);

    Example

    const jQueryUtils = require("@util.js/jquery");
    jQueryUtils
      .loadjQuery({
        src: "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js",
        window,
      })
      .then(($) => console.log($))
      .catch(console.log);

    Example

    const jQueryUtils = require("@util.js/jquery");
    jQueryUtils.loadjQuery({ window }, (error, $) => {
      if (error) return console.log(error);
      console.log($);
    });

    Install

    npm i @util.js/jquery

    DownloadsWeekly Downloads

    5

    Version

    0.41.1

    License

    MIT

    Unpacked Size

    15 kB

    Total Files

    7

    Last publish

    Collaborators

    • creemama