From 6277c94b4c9b752ad996a17f9eb3a25f448b95af Mon Sep 17 00:00:00 2001 From: Mark Lundin Date: Fri, 12 Apr 2024 13:15:05 +0100 Subject: [PATCH] Add lower camel case (#6251) --- src/framework/handlers/script.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/framework/handlers/script.js b/src/framework/handlers/script.js index 9206eed122b..d77f0f71fcb 100644 --- a/src/framework/handlers/script.js +++ b/src/framework/handlers/script.js @@ -8,6 +8,8 @@ import { ResourceLoader } from './loader.js'; import { ResourceHandler } from './handler.js'; import { ScriptAttributes } from '../script/script-attributes.js'; +const toLowerCamelCase = str => str[0].toLowerCase() + str.substring(1); + /** * Resource handler for loading JavaScript files dynamically. Two types of JavaScript files can be * loaded, PlayCanvas scripts which contain calls to {@link createScript}, or regular JavaScript @@ -164,7 +166,7 @@ class ScriptHandler extends ResourceHandler { } scriptClass.attributes = attributes; } - registerScript(scriptClass, scriptClass.name.toLowerCase()); + registerScript(scriptClass, toLowerCamelCase(scriptClass.name)); } }