UNPKG

1.39 kBJavaScriptView Raw
1import { __assign } from "tslib";
2
3var AbstractRenderer =
4/** @class */
5function () {
6 function AbstractRenderer(config) {
7 this.plugins = [];
8 this.config = __assign({
9 /**
10 * only dirty object will cause re-render
11 */
12 enableDirtyCheck: true,
13
14 /**
15 * enable auto rendering by default
16 */
17 enableAutoRendering: true,
18
19 /**
20 * enable dirty rectangle rendering by default
21 */
22 enableDirtyRectangleRendering: true,
23 enableDirtyRectangleRenderingDebug: false
24 }, config);
25 }
26
27 AbstractRenderer.prototype.registerPlugin = function (plugin) {
28 this.plugins.push(plugin);
29 };
30
31 AbstractRenderer.prototype.unregisterPlugin = function (plugin) {
32 var index = this.plugins.findIndex(function (p) {
33 return p === plugin;
34 });
35
36 if (index > -1) {
37 this.plugins.splice(index, 1);
38 }
39 };
40
41 AbstractRenderer.prototype.getPlugins = function () {
42 return this.plugins;
43 };
44
45 AbstractRenderer.prototype.getPlugin = function (name) {
46 return this.plugins.find(function (plugin) {
47 return plugin.name === name;
48 });
49 };
50
51 AbstractRenderer.prototype.getConfig = function () {
52 return this.config;
53 };
54
55 AbstractRenderer.prototype.setConfig = function (config) {
56 Object.assign(this.config, config);
57 };
58
59 return AbstractRenderer;
60}();
61
62export { AbstractRenderer };
\No newline at end of file