0.4.2 • Published 10 years ago

checkout-browser-kit v0.4.2

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

Build Status

Browserify install

npm install checkout-browser-kit

The npm version is transpiled. To get the full ES6 version, go to the Github project.

Ajax

CORS and JSONP

function ajax(url, params, successCallback, errorCallback, options);

Constants

ajaxConstants: {
    defaults: {
        TYPE: 'get',
        TIMEOUT_MS: 60000,
        CANCEL_PREVIOUS: true
    },
    REQUEST_SOURCE: 'JS',
    CKO_SCRIPT_ID: '__checkoutJSONP',
    states: {
        DONE: 4
    },
    statuses: {
        TIMEOUT: 0,
        OK: 200,
        GENERAL_ERROR: 500
    },
    headers: {
        AUTHORIZATION: 'Authorization',
        ACCEPT: 'Accept',
        CONTENT_TYPE: 'Content-Type',
        CKO_ACTION: 'X-CKO-Action',
        CKO_REQUEST_SOURCE: 'X-CKO-REQUEST-SOURCE'
    },
    headerValues: {
        JSON_TYPE: 'application/json',
        PLAIN_TEXT_TYPE: 'text/plain'
    }
}

DOM

DOM manipulation and helper functions

function ready(callback);
function createElement(tag, options);
function hasClass(element, cls);
function addClass(element, cls);
function removeClass(element, cls);
function enableElement(element);
function disableElement(element);
function addEventListener(target, eventName, callback);
function isElement(element);
function isJqueryLoaded();
function isJqueryElement(element);
function getElements([parent], selector);
function getElement([parent], selector[, fallbackElement]);

Event Manager

Pub/Sub utility

function dispatchEvent(eventName, data, loggingLevel);
function dispatchLogEvent(eventName, data);
function dispatchWarnEvent(eventName, data);
function dispatchErrorEvent(eventName, data);
function triggerEventHandlers(eventName, data);
function addEventHandler(eventName, handler);
function removeEventHandler(eventName, handler);
function removeEventHandlerAt(eventName, index);
function removeAllEventHandlers(eventName);
function getEventHandlerCount(eventName);
function isEventHandled(eventName);

Logger

Console logger

get debugMode();
set debugMode(value);
function log(msg, ...args);

Utils

function isValidJSON(jsonString);
function toQueryString(url, params);
function extend(target, ...);
function getIEVersion();
0.4.2

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.4

10 years ago

0.3.3

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago