S
SolidJS2mo ago
Aryxst

fix function running only on build

I want to load the function from this file on mount https://github.com/Aryxst/tauri-app/blob/master/src/use-controller.tsx in home.tsx:
import { onMount } from 'solid-js';
import useController from '../use-controller';

function Home() {
onMount(() => {
useController()
.on('pad-a-down', () => {
console.log('A is down!');
})
.on('pad-a-up', () => {
console.log('A is up!');
})
.on('pad-b-down', () => {
console.log('B is down!');
})
.on('pad-b-up', () => {
console.log('B is up!');
})
.on('pad-x-down', () => {
console.log('X is down!');
})
.on('pad-x-up', () => {
console.log('X is up!');
})
.on('pad-y-down', () => {
console.log('Y is down!');
})
.on('pad-y-up', () => {
console.log('Y is up!');
});
});

return <div>Hello World!</div>;
}

export default Home;
import { onMount } from 'solid-js';
import useController from '../use-controller';

function Home() {
onMount(() => {
useController()
.on('pad-a-down', () => {
console.log('A is down!');
})
.on('pad-a-up', () => {
console.log('A is up!');
})
.on('pad-b-down', () => {
console.log('B is down!');
})
.on('pad-b-up', () => {
console.log('B is up!');
})
.on('pad-x-down', () => {
console.log('X is down!');
})
.on('pad-x-up', () => {
console.log('X is up!');
})
.on('pad-y-down', () => {
console.log('Y is down!');
})
.on('pad-y-up', () => {
console.log('Y is up!');
});
});

return <div>Hello World!</div>;
}

export default Home;
Why does this work on build?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server