diff --git a/src/index.js b/src/index.js index 5b6686a9..a7f82063 100644 --- a/src/index.js +++ b/src/index.js @@ -21,6 +21,7 @@ export * from './render-core/index.js' export * from './render-canvas2d/index.js' export * from './render-webgl/index.js' export * from './movable/index.js' +export * from './name/index.js' export * from './integrator/index.js' export * from './gravity/index.js' export * from './damping/index.js' diff --git a/src/misc/plugin.js b/src/misc/plugin.js index b94aa713..077a4add 100644 --- a/src/misc/plugin.js +++ b/src/misc/plugin.js @@ -16,6 +16,7 @@ import { TimePlugin } from '../time/index.js' import { Transform2DPlugin, Transform3DPlugin } from '../transform/index.js' import { DefaultTweenPlugin } from '../tween/index.js' import { WindowPlugin } from '../window/index.js' +import { NamePlugin } from '../name/index.js' export class DefaultPlugin extends Plugin { @@ -25,6 +26,7 @@ export class DefaultPlugin extends Plugin { register(app) { app .registerPlugin(new TimePlugin()) + .registerPlugin(new NamePlugin()) .registerPlugin(new DevicePlugin()) .registerPlugin(new StoragePlugin()) .registerPlugin(new AudioPlugin()) diff --git a/src/name/components/index.js b/src/name/components/index.js new file mode 100644 index 00000000..5f36f873 --- /dev/null +++ b/src/name/components/index.js @@ -0,0 +1 @@ +export * from './name.js' \ No newline at end of file diff --git a/src/name/components/name.js b/src/name/components/name.js new file mode 100644 index 00000000..d05f52bc --- /dev/null +++ b/src/name/components/name.js @@ -0,0 +1,14 @@ +export class Name { + + /** + * @type {string} + */ + value + + /** + * @param {string} name + */ + constructor(name = '') { + this.value = name + } +} \ No newline at end of file diff --git a/src/name/index.js b/src/name/index.js new file mode 100644 index 00000000..8cac6976 --- /dev/null +++ b/src/name/index.js @@ -0,0 +1,2 @@ +export * from './components/index.js' +export * from './plugin.js' \ No newline at end of file diff --git a/src/name/plugin.js b/src/name/plugin.js new file mode 100644 index 00000000..4bbd8c44 --- /dev/null +++ b/src/name/plugin.js @@ -0,0 +1,12 @@ +import { App, Plugin } from '../app/index.js' +import { Name } from './components/index.js' + +export class NamePlugin extends Plugin { + + /** + * @param {App} app + */ + register(app){ + app.registerType(Name) + } +} \ No newline at end of file