当前位置: 软件>JavaScript软件
JavaScript框架 Archetype
本文导语: Archetype 是一个面向对象的 JavaScript 框架和 Ajax 框架。 示例代码: Archetype.Component.create({ name:"Sample.components.foobar", /** * Set up the Component dependencies */ setup:{ dependencies: { components:{}, lib:[] } }, /** * Constructor */ initialize: function () ...
Archetype 是一个面向对象的 JavaScript 框架和 Ajax 框架。
示例代码:
Archetype.Component.create({
name:"Sample.components.foobar",
/**
* Set up the Component dependencies
*/
setup:{
dependencies: {
components:{},
lib:[]
}
},
/**
* Constructor
*/
initialize: function () {
Logger.log("foobar has been instantiated!");
$(document.body).observe("click", this.createDate);
Logger.log("a click handler on the body of your page has been registered");
},
/**
* Private method which launch the DateUpdate event
* with the current date in parameter
*/
_createDate : function () {
this.fireDateUpdate(new Date());
},
/**
* Fire a "DateUpdate" event
*/
fireDateUpdate: _,
/**
* Listen to "DateUpdate" event
*/
onDateUpdate: function(eventName, date) {
Logger.log("foobar has received a date:" + date);
}
})