Question: Hi ! Can native modules be used in reactor (0.18) ?

Asked By
vankeisb
Asked At
2017-09-25 16:14:32

Found 15 possible answers.

User Answered At Possible Answer
ilias 2017-09-25 16:15:20 Sure
vankeisb 2017-09-25 16:15:27 mmmh nothing particular to do ? If so, it must be me...
ilias 2017-09-25 16:16:56 does your code compile with elm-make Main.elm ?
vankeisb 2017-09-25 16:18:06 it works, it was a mistake on my past part
ilias 2017-09-25 16:18:10 you may want to check that you're running elm-reactor in the right directory, that elm-package.json looks correct and has native-modules: true , that the github user/project there matches what you have in the code, etc; but at the end of the day, elm-reactor just uses elm-make :slightly_smiling_face:
vankeisb 2017-09-25 16:18:11 sorry for the noise...
ilias 2017-09-25 16:18:14 np @cmditch can you perhaps show some code?
cmditch 2017-10-14 19:01:45 indeed! and lastly, one other point of interest, but not significant https://github.com/cmditch/elm-web3/blob/1.0/test/TestContract.elm#L120 Here is the view code where a button ultimately calls to the EM, via InitEventOnce Msg https://github.com/cmditch/elm-web3/blob/1.0/test/Pages/Contract.elm#L71 https://github.com/cmditch/elm-web3/blob/1.0/src/Native/Web3.js#L57 https://github.com/cmditch/elm-web3/blob/1.0/src/Web3/Eth/Contract.elm#L179
ilias 2017-10-14 19:06:43 Right, is there a way I can reproduce the issue?
cmditch 2017-10-14 19:07:47 you would have to install what’s called Geth, the Ethereum client thanks! so extended brb :slightly_smiling_face: oof, gonna be a bit delayed @ilias , actually meeting up with @jadams and @adamdill for some lunch while they’re in town I’m going to clean up the console logs really quick and try to do a screen capture, it will be much easier to explain it via video/voice https://geth.ethereum.org/install/ once that’s installed, it should be quite easy to fire up
jadams 2017-10-14 19:15:47 \o/
ilias 2017-10-14 19:15:50 No problem, enjoy. I'm having a look at it anyway :slightly_smiling_face:
cmditch 2017-10-14 19:15:53 :slightly_smiling_face:
ilias 2017-10-14 20:50:43 @cmditch one thing to watch out for it using nativeBinding-based tasks in event managers - this may lead to unexpected results like a binding executing multiple times. It's advisable to run those things in separate processes (using Process.spawn ) and handle callbacks through sendToSelf (only counts for async nativeBindings, tho) For inspiration on how to implement such a thing - the websocket EM does exactly that This has the added advantage that native-bindings can't block the process if they take a while - basically you fork them off into a separate process Generally, this works perfectly well, except if a process can execute native bindings _and_ receive messages. The stepper doesn't have knowledge of whether or not a native-binding is in progress, so it blindly calls it again for every instance of the EM in the process queue. - that process is queued, regardless of whether it is already queued - the message is added to the mailbox of the process for some background - whenever a process (like an EM) is sent a message, 2 things happens:
cmditch 2017-10-14 21:12:52 oh my, this elucidates a ton interesting, in writing this EM, I leaned heavily on the Websocket library gonna take me a minute to unpack it

Related Questions