Jan 9, 2019


  • administrators

    Bar Smith
    I have been going through the V2 code to try to get myself up to speed on how it works and NPM/JS in general. I'm still grappling with => syntax, but for the most part things are making sense.

    I've been trying to answer my own questions but two things have me stumped.

    1. How does the event system work? Specifically I have been trying to trace how checking and unchecking the "grid" checkbox makes the grid show up and disappear. Where is the event listener for the mouse click? I can see that viewerControls.js and viewer.js are both involved, but there is more to it that I am missing.

    2. If I wanted to make a sphere show up in the example (demo.html) how would I do that. We have the JSCAD instance jscadInst1 and creating a second one creates a second JSCAD instance (awesome!), but I am unclear on how to interact with that instance. Is there a place I can look to better understand what I can do with that object? Index.js seems to assemble all of the parts, but if I wanted to make that instance compile a shape how would I do that?

    Thanks for bearing with the questions that probably have obvious answers I'm not seeing.
    2 comments
    2
    2 plus ones
    2
    no shares
    Shared publicly•View activity

    Bar Smith
    Oh no that's great! 
    
    The structure of declaring what you want seems like an excellent way to organize things. It gives you a lot of molecularity which is fantastic and one of the big reasons I want to jump into alpha V2.
    
    I looks to me like  sources.dom.select('.example').events('click') is the event listener right? Where is the click event generated? How and when do actions run? 
    

    Bar Smith
    Ok, thank you! I will read up on Most.js and Rxjs. I am loving js so far, but there are still a lot of things that are getting past me. It took me a couple hours to figure out that arrow function are actually functions 😄

    I have been working on the flow drawing side and GitHub integration parts of my project which has been a good way to get a better handle on how js works.