aframe-svelte

Aframe Svelte

Load svelte components as aframe components :magic:.

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

goblin-life

Used for instantiating remote entity mixins in goblin.life!

Playlist

Top categories

Loading Svelte Themes