modern minimalist vanilla javascript library in 4.9Kb
pi('#id')
pii('.class')
pi('#try').addClass('newClass'); // delClass hasClass toggleClass
pii.classAdd('.class', 'newClass');
pi.ready(function(){
});
// append child to
pi.H.append( pi('#u'), pi('#d') );
pi.H.append( '#u', '#d' );
// remove child
pi.H.remove( pi('#u') );
pi.H.remove( '#u' );
var listener = function(e) { console.log(e); };
pi('#try').on('click',listener);
pi('#try').rm('click',listener);
pii('.class').on('click',listener);
pii('#try .sub')[0].on('mouseover',listener);
var a = function(){ console.log('a'); };
var b = function(){ console.log('b'); };
pi.E.on( '#one', 'click', a );
pi.E.on( '#one', 'click', b );
// when click on #one -> print a \n b
// remove a listener
pi.E.rm( '#one', 'click', b );
// remove all click listeners
pi.E.purge( '#one', 'click' );
var callback = function(a){ console.log('LOG: '+a); };
pi.T.sub('NOTICE', callback);
pi.T.pub('NOTICE',['hello']);
pi.T.unsub({'topic':'NOTICE','callback':callback});
pi.T.pub('NOTICE',['hello']);
pi.S.set('key','value');
var value = pi.S.get('key');
pi.S.cache('key','value', ttl);
var hello = pi.S.namespace('hello');
hello.set('key','value'); // set key
hello.get('key'); // get key
var ok = function (data) { console.log(data); };
pi.A({
type:'GET',
url:'example.json',
success:ok
});
var ok = function (action,arg1,arg2) { console.log(arg1); };
pi.R.add('news', ok); -> hash -> #!/news/arg1/arg2
pi.R.bundle( [
{
route:'news',
callback:function(){ alert('news'); }
},
{
route:'defaultAction',
callback:function(){ alert('defaultAction'); }
}
] );
pi.R.start('defaultAction');
In the amazing javascript world we'll found many great framework/library, but this is the mine. I hate IE and i have no plans to support it. IE is a ugly program (i call him virus/malware).
I'm a humble javascript coder
Make website smart and amazing
Github!
- Firefox 3.5+
- Opera 9+
- Safari 4+
- Chrome 1+
- iPhone and iPad iOS1+
- Android phone and tablets 2.1+
- Blackberry OS6+
- Mobile Firefox
- Opera Mobile
- Windows 7.5+
- IE9+ (unwanted)
- TravisCi
- Coverall
- CodeClimate
- GitHub
made with <3 from italy