Introduction to alili-simple-js
alili-simple-js, it can do encryption, decryption, it can parse html strings into virtual DOM, it can parse css into a json structure, it can create custom events.
Install alili-simple-js
npm install alili-simple-js
// or
yarn add alili-simple-js
Use alili-simple-js
Use encryption
import Tool from 'alili-simple-js';
let Strength = 2; // The strength of the encryption ranges from 1 to 15
let c = new Tool.C(Strength);
/*
Encryption
*/
let str = '{a:1,c:2,b:{a:"str"}}'; // Encrypted string
let enstr = c.en(str); // en is Encryption method
console.log(enstr) // OE*Q5{*aYZ"ro]:11[l,c,MbYI"`M]:21rlbd,MQY*"O*]:{Q:5Y"aE])b"s/'jJw:xr#t.5)2"}1'j7}721
/*
Decryption
*/
let destr = c.de(enstr); // de is Decryption method
console.log(destr) // '{a:1,c:2,b:{a:"str"}}'
Use custom events
import Tool from 'alili-simple-js';
let customevent = new Tool.customEvent();
// Add a custom event
customevent.on('eventname',()=>{
// callback doing some thing
});
// Add a one-time custom event
customevent.once('eventname',()=>{
// callback doing some thing
});
// Trigger a custom event
customevent.emit('eventname',argument);
//Removes a custom event
customevent.off('eventname');
Use custom events
import Tool from 'alili-simple-js';
let customevent = new Tool.customEvent();
// Add a custom event
customevent.on('eventname',()=>{
// callback doing some thing
});
// Add a one-time custom event
customevent.once('eventname',()=>{
// callback doing some thing
});
// Trigger a custom event
customevent.emit('eventname',argument);
//Removes a custom event
customevent.off('eventname');