The sample code above is the result of a two-step transpilation (TypeScript, Google Closure with advanced minification): mod.ts → mod.js → mod.min.js.
The original TypeScript code is
class SHT1x {
constructor( options: SHT1xOptions, onReady?: () => void ) { … }
// Propiatary CRC checksum calculation for SHTx - has nothing to do with a real CRC calculation!
private static calculateCrcChecksum( data: number, initialCrcValue: number ): number { … }
}
I can remove the "static" keyword but it wouldn't be 100% semantically correct because there could be more instances of SHT1x and the checksum method does not need any instance variables. Nevertheless it's a good workaround.
Otherwise it would be good to know the origin of the problem. So the current Espruino rule to work around the bug is: Don't use class methods at all?
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.
The sample code above is the result of a two-step transpilation (TypeScript, Google Closure with advanced minification): mod.ts → mod.js → mod.min.js.
The original TypeScript code is
I can remove the "static" keyword but it wouldn't be 100% semantically correct because there could be more instances of SHT1x and the checksum method does not need any instance variables. Nevertheless it's a good workaround.
Otherwise it would be good to know the origin of the problem. So the current Espruino rule to work around the bug is: Don't use class methods at all?
I have to check other modules I contributed: