Skip to content

Latest commit

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

nova.js

A small library with utilities for class based JavaScript programming

Creating Classes

varDOMReady=nova.Class({initialize: function(){$($.proxy(this.domReady,this));},domReady: function(){}});
varCustomEvents=nova.Class({addEvent: function(ev,fn){this.events=this.events||{};this.events[ev]=this.events[ev]||[];this.events[ev].push(fn);},trigger: function(ev,args){if(this.events&&this.events[ev]){varevents=this.events[ev],i,l=events.length;for(;i<l;i++){events[i].apply(null,args);};}}});
varContextSelector=nova.Class({$: function(selector){return$(selector,this.el);}});

Extending and Implementing Classes

varElementView=nova.Class({extend: DOMReady,implement: [CustomEvents,ContextSelector]});
varProductDetail=ElementView.extend({domReady: function(){this.el=$('body');this.changeColor();},changeColor: function(){this.$('p').css('color','red');}})varproduct=newProductDetail();

About

A small library with utilities for class based JavaScript programming

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages