nexus-js/ui

Missing Visualization pages in API docs

pierredewilde opened this issue · 6 comments

When selecting any Visualization pages, nothing is displayed.

https://nexus-js.github.io/ui/api/#Meter
https://nexus-js.github.io/ui/api/#Oscilloscope
https://nexus-js.github.io/ui/api/#Spectrogram

The console logs an error:

moustache.min.js:1 Uncaught TypeError: Cannot read property 'name' of undefined
    at Context.lookup (moustache.min.js:1)
    at Writer.escapedValue (moustache.min.js:1)
    at Writer.renderTokens (moustache.min.js:1)
    at Writer.render (moustache.min.js:1)
    at Object.render (moustache.min.js:1)
    at doc ((index):1791)
    at load ((index):1910)
    at (index):1774

please, is it possible to have a look at that? Thank you very much.

I think it is related to api.json file. I'm not sure wether it is done on purpose, or by mistake, but Meter / Oscilloscope / Spectagram don't have their names set as value for "name" key, Instead, there are multiple objects with values like "context" / "connect" / "disconnect" used for naming. But in reality those are the names of their methods.

Here I'm showing just the Button related json. (see name: "Button"). This value is used to match the url hash with the given object.

Button

After the api.json is being parsed and all the objects have been created (named after key => "name"), it looks like this:

nexus1

We don't see objects for Meter/Oscilloscope/Spectagram, as in api.json they were represented by their methods, which in this case are connect / disconnect / context. To be worse, if two objects share the same method names as Oscilloscope and Spectagram do, the later will overwrite the Oscilloscope, which is why we see the following:

connect

I managed to fix it by making this three json parts to be like all the others, but I'm not sure author had that in mind (maybe it is related to the fact that they must get Nexus audio context from the outside and connect to it, or maybe the script that's generating this api.json file just started to screw around.

This is what I've got after these changes:

final

If we could just put connect/disconnect/... methods into the methods array, without breaking something else it would do the trick.

I figure it was all because of this line in all 3 files:

import { context } from "../main";

Think it made a problem to the script that is generating api.json file, as it thought that brackets represent class (with comments above it).

This is the state before:

context

And this is after I moved it above the comments:

context2

Finally they are again here :))

spectogram

oscilloscope

meter

Hi @vladansaracpv Is there any chance you could push this back as a PR but based on a clean branch created out of fresh master fork?

Hey @styk-tv,
I've created Pull Request 159

Thanks for the PR @vladansaracpv. The docs are now updated.