From 4bbae6a5f454120fbe8bd2d51b014167b62b1e28 Mon Sep 17 00:00:00 2001 From: jiyeongjun Date: Fri, 3 May 2024 11:32:20 +0900 Subject: [PATCH] feat: add CustomEventClass toString static method --- rune/package.json | 2 +- rune/src/CustomEventWithDetail.ts | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/rune/package.json b/rune/package.json index 2594af4..2e220df 100644 --- a/rune/package.json +++ b/rune/package.json @@ -1,6 +1,6 @@ { "name": "rune-ts", - "version": "0.8.7", + "version": "0.8.8", "description": "Rune Core Library", "engines": { "node": ">=14.0.0" diff --git a/rune/src/CustomEventWithDetail.ts b/rune/src/CustomEventWithDetail.ts index 3949809..fbf1989 100644 --- a/rune/src/CustomEventWithDetail.ts +++ b/rune/src/CustomEventWithDetail.ts @@ -1,3 +1,5 @@ +import { _camelToColonSeparated } from './lib/_camelToColonSeparated'; + if (typeof global !== 'undefined') { global.CustomEvent = global.CustomEvent || @@ -10,7 +12,11 @@ if (typeof global !== 'undefined') { }; } -export class CustomEventWithoutDetail extends CustomEvent {} +export class CustomEventWithoutDetail extends CustomEvent { + static override toString() { + return _camelToColonSeparated(this.name); + } +} export class CustomEventOptionalDetail extends CustomEvent {} @@ -31,4 +37,8 @@ export class CustomEventWithDetail extends CustomEvent { } private readonly isCustomEventWithDetail = true; + + static override toString() { + return _camelToColonSeparated(this.name); + } }