0.0.6 • Published 5 years ago
@uak2020/jquery-utilities v0.0.6
jquery-utilities
istanbul (nyc) coverage report
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 { JqAjaxGetManager, UserInteraction, JsHelper } = require('@uak2020/jquery-utilities');
var userInteraction = new UserInteraction();
var jsHelper = new JsHelper();
var ajaxGetMgr = new JqAjaxGetManager();
ajaxGetMgr.userInteraction = userInteraction;
ajaxGetMgr.jsHelper = jsHelper;
ajaxGetMgr.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.