moved global component registry code

This commit is contained in:
Geoff Doty 2022-12-18 16:28:21 -05:00
parent cea6054e64
commit e85a230553
3 changed files with 12 additions and 12 deletions

View File

@ -31,6 +31,7 @@ dist/ <-- `npm run build` app
src/ <-- your source code src/ <-- your source code
css/ <-- processed css files css/ <-- processed css files
js/ <-- processed javascript files js/ <-- processed javascript files
registry.js <-- global component registry
public/ <-- unprocessed static `/` assets public/ <-- unprocessed static `/` assets
components/ <-- riots components components/ <-- riots components
hello-riot/ hello-riot/
@ -68,7 +69,7 @@ This template uses a static object registry to mount global **components** which
</my-page> </my-page>
``` ```
> SEE: `/src/index.js` for more information > SEE: `/src/index.js` & `/src/js/registry.js` for more information
### Tests ### Tests

View File

@ -1,10 +1,2 @@
import {Register} from './js/register.js'; // bootstraps global components
import HelloRiot from './components/hello-riot/hello-riot.riot'; import './js/registery.js';
// define global components here
const registry = {
'hello-riot': HelloRiot
};
// register global components
Register(registry);

View File

@ -1,4 +1,5 @@
import {register, mount} from 'riot'; import {register, mount} from 'riot';
import HelloRiot from '../components/hello-riot/hello-riot.riot';
/** /**
* Register Global Components * Register Global Components
@ -20,4 +21,10 @@ export function Register(registry = {}) {
}); });
} }
export default Register; // define global components here
const registry = {
'hello-riot': HelloRiot
};
// export registered global components
export default Register(registry);