Skip to main content
Deno 2 is finally here 🎉️
Learn more

jquery-utilities

GitHub npm version Build Status Coverage Status Maintainability Test Coverage

istanbul (nyc) coverage report

Statements Branches Functions Lines
Statements Branches Functions Lines

About

A set of tools based on jQuery

  • Tool 1 - jQuery AJAX Manager

Installation

npm install @uak2020/jquery-utilities

Usage

Tool 1 Usage - jQuery AJAX Manager

var { JqAjaxManager, UserInteraction, JsHelper } = require('@uak2020/jquery-utilities');

var userInteraction = new UserInteraction();
var jsHelper = new JsHelper();
var ajaxMgr = new JqAjaxManager();
ajaxMgr.userInteraction = userInteraction;
ajaxMgr.jsHelper = jsHelper;
ajaxMgr.performAjaxGet(
    'http://localhost:5000/test',
    {
        successMessage: 'page loaded',
        successCallback: function (result, url, textStatus) {
            userInteraction.logit(result);
        }
    },
    {
        failureMessage: 'page load error',
        failureCallback: function (textStatus, errorThrown) {
            userInteraction.logerror(errorThrown);
        }
    }
);

Points to note:

  • successMessage and failureMessage can be omitted
  • successMessage and failureMessage if provided as above, then browser alerts will be shown
  • one must set “userInteraction” field/property of JqAjaxManager object as done above like: ajaxMgr.userInteraction = userInteraction;
  • one must set “jsHelper” field/property of JqAjaxManager object as done above like: ajaxMgr.jsHelper = jsHelper;

Tests

yarn test

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.