Giter VIP home page Giter VIP logo

ju-shared's Introduction

Build Status

ju-shared

Using an Object-Oriented Javascript approach in most cases, the following classes and modules are provided:

Object-Oriented Javascript

class.js

Can be used to implement a Javascript Class, with support for constructor, inheritance, class methods, singleton pattern and method injection

observable-class.js

Build on top of Class, with support for triggering events that can have an attached observer function

Ajax

base-proxy.js

Wraps jQuery.ajax and exposes methods for handling request success/error, together with error handling utilities

Client-side variable handling

client-vars-manager.js

Stores a variable dictionary with helpers for handling stored values

app-config-manager.js

Specialization of ClientVarsManager for handling configuration values

l10n.js

Specialization of ClientVarsManager for handling localization

Utilities

dependency-loader.js

Asynchronous dependency injection with require.js

logger.js

Safe logging with support for server or browser console logging

md5-encoder.js

Helper for MD5 or Base64 encoding

util.js

Utility functions

ju-shared's People

Contributors

andreybs11 avatar canamo06 avatar jpgarbanzo avatar kevter avatar klam avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jpgarbanzo

ju-shared's Issues

Remove redundant callback wrapper from ajax handler hook

The callback beforeMakingAjaxRequest in the code below simply does what the code in the else executes. I'd like to remove the callback in order for the hook to be able to do more useful processing without having the side effect of executing the ajax callback.

if ('function' === typeof this.opts.beforeMakingAjaxRequest) {
    var performAjaxRequestCallback = $.proxy($.ajax, $);
    return this.opts.beforeMakingAjaxRequest(performAjaxRequestCallback, params);
} else {
    // if no hook is provided, performs the request
    return $.ajax(params);
}

Error logger won't properly provide context when the Error object isn't the first argument

If you look at the current error logger function it adds the error context depending on whether an Error object is provided as the first argument or not.

If the Error object isn't the first argument, a more generic stack trace will be generated and, more importantly, the context sent to the server will skip the original error message, as JSON.stringify(Error) won't work; and the common case is to log errors like Logger.error('Something custom failed', errorThrown, moreDetails...)

We should get the proper error stack regardless of the position of the error argument

Wrap jQuery's methods exposed by $.ajax handler

Since merging a pull request to expose the $.ajax handler (#11) we're allowing the developers to add code that's tightly coupled with jQuery's API.

We should wrap this object with BaseProxy's methods in order to avoid such dependency.

Improvements to logger

We need to add more information to the logger so we get useful data.
Adding the stack trace when there is an error would be a great start.

Navigator online status is not reliable

Today I found a situation where my wifi chipset and the browser where "unreachable", ending in a situation where the window.navigator.onLine always return false. This means a user may think there is no connection BUT it does.

ENVIRONMENT
Macbook Pro 2015
Chrome Version 64.0.3282.140

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.