Skip to content

Commit

Permalink
Component properties port to get/set (#6145)
Browse files Browse the repository at this point in the history
* add abstract set/get for enabled in component class

* moved description to get/set

* removed commented code
  • Loading branch information
kpal81xd authored Mar 12, 2024
1 parent b4d3cf0 commit d276f53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
13 changes: 12 additions & 1 deletion src/framework/components/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { EventHandler } from '../../core/event-handler.js';
* Components are used to attach functionality on a {@link Entity}. Components can receive update
* events each frame, and expose properties to the PlayCanvas Editor.
*
* @property {boolean} enabled Enables or disables the component.
* @augments EventHandler
*/
class Component extends EventHandler {
Expand Down Expand Up @@ -113,6 +112,18 @@ class Component extends EventHandler {
const record = this.system.store[this.entity.getGuid()];
return record ? record.data : null;
}

/**
* Enables or disables the component.
*
* @type {boolean}
*/
set enabled(arg) {
}

get enabled() {
return true;
}
}

export { Component };
9 changes: 0 additions & 9 deletions utils/types-fixup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ const getDeclarations = (properties) => {
return declarations;
};

const componentProps = [
['enabled', 'boolean']
];

path = './types/framework/components/component.d.ts';
dts = fs.readFileSync(path, 'utf8');
dts = dts.replace(regexConstructor, '$&\n' + getDeclarations(componentProps));
fs.writeFileSync(path, dts);

const buttonComponentProps = [
['active', 'boolean'],
['fadeDuration', 'number'],
Expand Down

0 comments on commit d276f53

Please sign in to comment.