np.sub('xyz',function(){
console.log('xyz is happend');
})
np.pub('xyz');
var li1 = niepan(document.getElementById('li1'));
console.log(li1);
li1.sub('click',function(){
console.log('clicked li1,this event could be pubed all the time');
});
var body= niepan(document.body);
console.log(body);
body.sub('click',function(){
console.log('clicked body,this event would be pubed only one time');
},true);
It will throw a error when define a niepan for the same element moe than one time;
var input = niepan(document.getElementById('input1'));
var input = niepan(document.getElementById('input1'));
np.request({
url:'https://server/xxx',
success:function(res){
console.log(res);
}
});
var input1 = niepan(document.getElementById('input1'));
input1.sub('input',function(evt){
console.log(input1.$data.name);
});