Javascript front-end utils

Maintainers

Details

github.com/edwrodrig/js

Source

Issues

Installs: 148

Dependents: 1

Suggesters: 1

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 1

Language:JavaScript

3.1.0 2019-12-14 16:11 UTC

This package is auto-updated.

Last update: 2024-04-17 05:52:00 UTC


README

Little utility javascript front-end library for simple pages

Latest Stable Version Total Downloads License

My use cases

I'm a back end guy but I can't escape to deal with web pages. I hate current front-end development technologies, specially javascript, the Justin Bieber of languages. But you can escape to it, It's the browser language! For me less javascript is better javascript.

  • I don't want to include this big javascript libraries in my code to do simple task that a simple script can handle.
  • I don't want to invest time finding what is the best way to do something in some fancy framework.
  • I don't want to install nodejs or npm on my development machines.
  • I want to maintain the things as simple as possible

These are the functionalities that contains this library:

I test all my code in Firefox Quantum 60 on Ubuntu 16.04 and in Chrome Mobile in my Android device. I don't test that much on other platforms. I ignore backward compatibility with older browsers like IE. Safari is a target but I do not test against it because I don't have an Apple. I sometimes test with other webkit based browser like Midori to replicate reported errors.

About my json requests

My format is very particular. I'm not a fan of RESTful because it mixes the json payload with HTTP status and verbs. I like that all information goes in only one format, it makes easier when you want to implements other ways of communication, like raw TCP sockets. In simple words, my format just put some status corresponding the function of the HTTP status in the json. There is an example:

{
    "status" : 1,
    "data" : {
      "name" : "Edwin",
      "surname" : "Rodriguez"
    }
}

My request implementation just do a post call and conveniently handle the status code to retrieve the data. It is my particular case and I don't think anyone is using it, but it is my library.

Documentation

The source code is documented using jsDoc style, so it should pop up nicely if you're using IDEs like PhpStorm or similar.

Examples

Composer

composer require edwrodrig/js

Inclusion

Considering that this is a javascript library, composer only download the files to vendor directory. It up to you how to use in your html pages. The basic way that I use this library is to create a symbolic link to the src folder so I can include the files in the target html page. As an example see examples folder that has a symbolic link to the source folder.

Testing

The test are built using QUnit. I don't know if they can be automated but if you just run the test page you will see a unit test report. This is better than nothing, and in many ways is enough for me.

License

MIT license. Use it as you want at your own risk.

About language

I'm not a native english writer, so there may be a lot of grammar and orthographical errors on text, I'm just trying my best. But feel free to correct my language, any contribution is welcome and for me they are a learning instance.