Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using module in es6 #9

Open
jeky1950 opened this issue Dec 29, 2024 · 0 comments
Open

Using module in es6 #9

jeky1950 opened this issue Dec 29, 2024 · 0 comments

Comments

@jeky1950
Copy link

I am trying to use Via.js inside a Vue app. I am finding it difficult to import the receiver. I keep getting a typescript error of 'cannot find this module'. Can you correct my work. Here is what I have so far:

Hello World

Click
<script setup lang="ts">
     import ViaReceiver from 'via.js/receiver';

     onMounted(() => {
           let worker = new Worker("worker.js");
        
           // Hook up Via's messages with the worker's postMessage bridge
           worker.onmessage = (e => ViaReceiver.OnMessage(e.data));
           ViaReceiver.postMessage = (data => worker.postMessage(data));
        
           // Start the worker
           worker.postMessage("start");
     })
</script>

Yours Sincerely
Anthony Jekanyika

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant