1.0.1 • Published 4 years ago

aframe-svelte v1.0.1

Weekly downloads
2
License
MIT
Repository
-
Last release
4 years ago

aframe-svelte

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

npm.io

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

goblin-life

Used for instantiating remote entity mixins in goblin.life!

Playlist

1.0.1

4 years ago

1.0.0

4 years ago