Sidi_Mohammed

Sidi_Mohammed

Use Typescript libraries from Phoenix/Liveview application

Hello,
Iam building Phoenix/LiveView application that should connect a different mobile app to this application, there is already a library written in Typescript, Iam not very frontend developer so excuse my primitive, since the library is in Typescript, I couldn’t import it to app.js so I decided to convert app.js to app.ts (I don’t know if this is the best practice for that) following this tutorial, after a while I have succeed to eliminate errors and get the file compiled, but once I initialize the constructor that create the connection instance, something went wrong behind scenes concerning LiveView because the Phoenix logs stop to appear when interacting with Liveview components like buttons

***** file app.ts *****
import {SeeraConnect} from "@seeraconnect" 
....
const seeraConnect = new SeeraConnect()
....

Once I put the constructor in comment, Phoenix LiveView logs return to work normally, so:
1- Is turning app.js to app.ts is a good practice to use Typescript libraries or there is another better way ?
2- Why Phoenix/Liveview normal behaviour gets interrupted when creating the Typescript instance ? (I verified that everything else is fine)
I will be very thankful to help me please.

Most Liked

sodapopcan

sodapopcan

It sounds more like that it’s more likely whatever SeeraConnect is is the problem. Is it adding any behaviour to buttons or forms that might conflict with LV’s behaviour?

Last Post!

Sidi_Mohammed

Sidi_Mohammed

The library is to connect a specific mobile app to my Phoenix application, that means after setting everything perfectly a user can use this mobile application regularly by redirecting him from the browser to this app.
To keep everything simple, I have just one button “Connect” with phx-click="connect" and handling this event by doing nothing {:noreply, socket} just for testing, when I instanciate seeraConnect and click this button, the Phoenix logs stop to be shown, when I put this constructor in comment, Phoenix logs the handling of this button click, that’s what happened.

Where Next?

Popular in Questions Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

Other popular topics Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54996 245
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40082 209
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42576 114
New

We're in Beta

About us Mission Statement