1.0.9 • Published 6 years ago

niepan v1.0.9

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

niepan

Gitter Gitter

var np = niepan();

event

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'));//ERROR

http request

np.request({
  url:'https://server/xxx',
  success:function(res){
    console.log(res);
  }
});

two-way data-binding

<input id="input1" type="text" value="" watch="name" placeholder="place input your name" />
var input1 = niepan(document.getElementById('input1'));
input1.sub('input',function(evt){
  console.log(input1.$data.name);
});
1.0.9

6 years ago

1.0.8

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago