We have created this library, because we know out there are lots of vanilla js in development apps, and we know that sometimes some helpers are welcomed.
devanilla purpose is to ease your way when you search for DOM elements or want to apply events to one or multiple elements, do Ajax calls, etc.
$ npm install devanilla
Only the methods updated below are working properly now
import devanilla from 'devanilla'
or
const devanilla = require('devanilla')
Find element or elements
let element = devanilla.find('header')
Add class
let element = devanilla.find('header')
devanilla.addClass('my-class second-class', element)
//Alternative
devanilla.addClass('my-class second-class', 'header')
Remove class
let element = devanilla.find('header')
devanilla.removeClass('my-class second-class', element)
//Alternative
devanilla.removeClass('my-class second-class', 'header')
GET
let getCall = devanilla.get('my/url');
getCall.then(function(data) {
let receivedData = JSON.parse(data);
}, function(error) {
console.error(error);
});
POST
let postCall = devanilla.post('my/url', data, headers);
postCall.then(function(data) {
let receivedData = JSON.parse(data);
}, function(error) {
console.error(error);
});
$ npm install
$ npm dev //watches for changes and run babel
After changes raise PRs.
Contributing PRs will be reviewed once an initial version 1 will be released.