tilk / digitaljs

Teaching-focused digital circuit simulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README Does not reflect actual usage.. Better Documentation on usage?

cpt-n3mo opened this issue · comments

Good day,..

i have been playing around with this project but i cant seem to get this to work correctly with the info inside the README file ,

// create the simulation object const circuit = new digitaljs.Circuit(input_goes_here);
there is nothing named digitaljs.Circuit
and should be apparently be.
const circuit = new digitaljs.HeadlessCircuit(json)
// display on #paper const paper = circuit.displayOn($('#paper'));
there is nothing called displayOn() ?
// activate real-time simulation circuit.start();
not useable as displayOn is not found..

im i missing something here..?

kind regards.

Here you have an example, working exactly as in the README.

https://github.com/tilk/digitaljs/blob/master/examples/template.html

Good day,
thx for the response. i checked it out and this makes a bit more sense, but i cant seem to be able to import this into a Vue.js or Nuxt.js project, as it will not compile with default babel and webpack configs,
do you have any idea how i can get this to work in nuxt/vue as adding these babel plugins as described in the example plugins:["babel-plugin-add-import-extension","babel-plugin-transform-import-meta"]
and added webpack config
{ include: path.resolve(__dirname, "./node_modules"), test: /\.mjs$/, type: 'javascript/auto', }
then build fails with

` ERROR Failed to compile with 16 errors friendly-errors 18:21:21

These relative modules were not found: friendly-errors 18:21:21
friendly-errors 18:21:21

  • ../../components/Logo.vue.js in ./.nuxt/components/index.js friendly-errors 18:21:21
  • ../layouts/default.vue.js in ./.nuxt/App.js friendly-errors 18:21:21
  • ./cells.js in ./node_modules/digitaljs/src/index.mjs friendly-errors 18:21:21
  • ./circuit.js in ./node_modules/digitaljs/src/index.mjs friendly-errors 18:21:21
  • ./components/nuxt-build-indicator.js in ./.nuxt/App.js friendly-errors 18:21:21
  • ./components/nuxt-error.vue.js in ./.nuxt/index.js friendly-errors 18:21:21
  • ./components/nuxt-loading.vue.js in ./.nuxt/App.js friendly-errors 18:21:21
  • ./elkjs.js in ./node_modules/digitaljs/src/index.mjs friendly-errors 18:21:21
  • ./engines.js in ./node_modules/digitaljs/src/index.mjs friendly-errors 18:21:21
  • ./engines/browsersynch.js in ./node_modules/digitaljs/src/index.mjs friendly-errors 18:21:21
  • ./iopanel.js in ./node_modules/digitaljs/src/index.mjs friendly-errors 18:21:21
  • ./monitor.js in ./node_modules/digitaljs/src/index.mjs friendly-errors 18:21:21
  • ./nuxt-error.vue.js in ./.nuxt/components/nuxt.js friendly-errors 18:21:21
  • ./style.css.js in ./node_modules/digitaljs/src/index.mjs friendly-errors 18:21:21
  • ./tools.js in ./node_modules/digitaljs/src/index.mjs friendly-errors 18:21:21
  • ./transform.js in ./node_modules/digitaljs/src/index.mjs
    `

this seems to be a very nice project and i would love to work with it. if i could get it to work ..
kind regards..

I'm sorry, I have no idea about Vue.js and Next.js, and I'm not really an expert on Webpack. You have to figure it out by yourself. This is not a commercial product and I don't provide support.

i see i understand..
thats very sad to hear, i understand its not a commercial product. but usually, you do get something like a dependentie list etc or, or at least some info on how to instantiate the module.. and as far as i know these things are usually managed inside the module to abstract it away from the user using the module..

if i figure it out i might write up a README tut on how to use the module and set it up properly, but for now i will leave it for what it is. a nice project but unusable, as after 2 days of smashing my head against the wall, and questioning my sanity an javascript skills. i think i'll bench this project..

kind regards..

This is an NPM package, no dependency list is required, everything is in package.json. An example project using it is DigitalJS Online, another (and simpler) is DigitalJS Tester. This should be enough for you to get things going.