
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
Base 是一个基础类,提供 Class、Events、Attribute 和 Aspect 支持。
Base.extend(properties)基于 Base 创建子类。例子:
/* pig.js */
define(function(require, exports, module) {
var Base = require('base');
var Pig = Base.extend({
attrs: {
name: ''
},
talk: function() {
alert('我是' + this.get('name'));
}
});
module.exports = Pig;
});
继承 Base 可覆盖 initialize 构造函数, 但需要调用父类构造函数,如 arale 的 widget 定义了组件的生命周期
/* widget.js */
define(function(require, exports, module) {
var Base = require('base');
var Widget = Base.extend({
initialize: function(config) {
Widget.superclass.initialize.call(this, config);
this.parseElement()
this.initProps()
this.delegateEvents()
this.setup()
},
...
});
module.exports = Widget;
});
Base 继承和混入了一下功能,可查看文档 :
Base 是使用 Class 创建的一个基础类,默认混入了 Events、Attribute、Aspect 模块:
/* base.js */
define(function(require) {
var Class = require('class');
var Events = require('events');
var Aspect = require('./aspect');
var Attribute = require('./attribute');
var Base = Class.create({
Implements: [Events, Aspect, Attribute],
initialize: function(config) {
...
},
...
});
...
});
1.0.0
正式版本
FAQs
Base 是一个基础类,提供 Class、Events、Attribute 和 Aspect 支持。
We found that anima-base demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.