Skip to content

Load svelte components as aframe components :magic:.

License

Notifications You must be signed in to change notification settings

AGoblinKing/aframe-svelte

Repository files navigation

aframe-svelte

Ever want to load a svelte component in aframe as a component? No? Well I did it anyhow.

API

multiple: true,
schema: {
	props: {
		// pass props to svelte component
		default: {},
	},
	// the svelte component
	component: {},
	// fn to run to gather props
	gather: {
		default() {
			return this.data.props
		},
	},
},

Quick Start

REPL Example

FancyWidget.svelte

<script>
export let parent
</script>

Your parent is a {typeof parent}

Consumer of Fancy and Svelte

<script>
import { registerSvelte, registerGather } from "aframe-svelte"
import FancyWidget from './FancyWidget.svelte'

registerSvelte("FancyWidget", FancyWidget)

// Gather and return props after instantiating
registerGather("Parent", function() {
	return {
		parent: "foobar"
	}
})
</script>

<a-mixin svelte="component: FancyWidget; gather: Parent" />

Usage

Used for instantiating remote entity mixins in goblin.life!

Playlist

About

Load svelte components as aframe components :magic:.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published