Skip to content

yegao/niepan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
});

About

a javascript framework 💣NOT FINISHED,DO NOT USE IT NOW 💣

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published