Frontmatter
| id | 5430 |
| title | Shorten class exports for singleton files |
| state | Closed |
| labels | enhancement |
| assignees | tobiu |
| createdAt | Jun 22, 2024, 10:50 AM |
| updatedAt | Jun 22, 2024, 3:10 PM |
| githubUrl | https://github.com/neomjs/neo/issues/5430 |
| author | tobiu |
| commentsCount | 0 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jun 22, 2024, 3:10 PM |
I guess this one is a bit controversial. file size VS readability.
for a normal class we are doing:
for a singleton it changes to:
=> setupClass() will return an instance if (and only if) the singleton config is set to true.
while the code will shorten when getting minified:
i would still prefer:
rationale: you don't define variables for things you only use once.