UNPKG

@qier-player/danmaku

Version:

Powerful danmaku, support many features.

56 lines 1.98 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import { EventEmitter } from '../utils/eventmitter'; import Track from '../track'; var Base = /** @class */ (function (_super) { __extends(Base, _super); function Base(config, options) { var _this = _super.call(this) || this; _this.tracks = []; _this.waitingQueue = []; _this.trackWidth = config.trackWidth; _this.trackHeight = options.trackHeight; _this.duration = options.duration; _this.tracksCnt = options.tracksCnt; for (var i = 0; i < options.tracksCnt; ++i) { _this.tracks[i] = new Track(); } return _this; } /** * 遍历所有轨道并回调 */ Base.prototype.each = function (handler) { for (var i = 0; i < this.tracks.length; ++i) { handler(this.tracks[i], i, this.tracks); } }; /** * resize * @param {Number} [height] 每个轨道高度 */ Base.prototype.resize = function (width, height) { if (width) { this.trackWidth = width; } if (height) { this.trackHeight = height; } }; return Base; }(EventEmitter)); export default Base; //# sourceMappingURL=base.js.map