cljsjs

mikebelanger 2016-11-28T17:12:32.001311Z

hey guys I'm testing out my externs -- Google Closure keeps spitting back the error that it expected a '}' on the last line, but I don't see any reason to put one there

mikebelanger 2016-11-28T17:12:47.001312Z

Here's the file it complains about -- on the last line : https://github.com/mikebelanger/cljs-tonejs/blob/master/resources/cljsjs/tonejs/common/Tone.ext.js

juhoteperi 2016-11-28T17:22:59.001314Z

I don't know about that, but you can't e.g. assign stuff to Tone.Event.prototype unless you have created Tone.Event first

juhoteperi 2016-11-28T17:23:12.001315Z

e.g. Tone.Event.prototype.start will fail unless there is Tone.Event = {};

juhoteperi 2016-11-28T17:23:32.001316Z

You can check this by evaluating the file in browser

juhoteperi 2016-11-28T17:23:48.001317Z

Just copy the contents into console or something

juhoteperi 2016-11-28T17:24:12.001318Z

you can also try running the file in Node, that should probably also give better syntax errors than Closure

mikebelanger 2016-11-28T17:29:44.001320Z

@juhoteperi oh so something like Tone.Event.Prototype = function() {} -> Tone.Event = {};

juhoteperi 2016-11-28T17:29:54.001321Z

Probably

mikebelanger 2016-11-28T17:30:52.001322Z

@juhoteperi I tried Node and the browser, each gave different errors, which is puzzling.

mikebelanger 2016-11-28T17:32:31.001323Z

@juhoteperi I have a feeling that your suspicions are right though, and only the bottom functions should be declared as prototypes. Does that sound right?

juhoteperi 2016-11-28T17:32:49.001324Z

Doesn't really matter at all if anything is declared as prototypes

juhoteperi 2016-11-28T17:33:19.001325Z

Tone.Multiply.prototype.setValueCurveAtTime => Tone.Multiply.setValueCurveAtTime would work as well

juhoteperi 2016-11-28T17:33:32.001326Z

Closure only cares about names

juhoteperi 2016-11-28T17:34:24.001327Z

var setValueCurveAtTime = {};, foo.setValueCurveAtTime = {};, Tone.Multiply.prototype.setValueCurveAtTime = function() {}; all should result in setValueCurveAtTime calls being preserved

juhoteperi 2016-11-28T17:35:04.001328Z

But the object hierarchy is probably useful for maintaining the extern file

mikebelanger 2016-11-28T17:45:15.001329Z

Wait, Atom keeps adding a blank line at the very end of my file, ever time I save. Could that be it?

juhoteperi 2016-11-28T17:47:18.001330Z

Shouldn't matter

mikebelanger 2016-11-28T17:58:06.001331Z

god how did Javascript become so damn popular

mikebelanger 2016-11-28T18:10:35.001332Z

oh so it was an unclosed } in the middle of the file. My bad, but god why do all dubuggers point at the end?

mikebelanger 2016-11-28T18:19:33.001333Z

@juhoteperi anyways thanks again