Ahh, right! It still makes me cringe a bit :) Maybe just add a comment as to why it's like that?
If the OneWire.write(Array) is added it'd actually simplify that a lot.
Does the delay after writing seem to be a common thing? If so it might be worth adding a 'finished' callback to the API?
if you don't export the whole class, then you can't add things to the prototype?
Well, you can, it's just ever so slightly more difficult:
function A() {
}
function getA() {
return new A();
}
var a= getA();
a.__proto__.constructor.prototype.bob = 42;
a.bob
// 42
Personally I'm not sure it's really worth the extra effort and memory usage to make it a tiny bit easier for the few people who would want to extend the basic class.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Ahh, right! It still makes me cringe a bit :) Maybe just add a comment as to why it's like that?
If the
OneWire.write(Array)
is added it'd actually simplify that a lot.Does the delay after writing seem to be a common thing? If so it might be worth adding a 'finished' callback to the API?
Well, you can, it's just ever so slightly more difficult:
Personally I'm not sure it's really worth the extra effort and memory usage to make it a tiny bit easier for the few people who would want to extend the basic class.