Open bdonnahue opened 5 years ago
Happy to support this if you are able to add it.
https://github.com/marcelklehr/socialcalc/commit/71216c0437e78838b0567ecd7a7607c3a27b44b4
The function code is here: https://github.com/marcelklehr/socialcalc/blob/master/js/formula1.js
Help Text https://github.com/marcelklehr/socialcalc/blob/master/js/socialcalcconstants.js
Auto generated SocialCalc.js
Nice, thanks @eddyparkinson! I am still working on this, it has been on the back burner but I will be picking it up again soon.
Hey @eddyparkinson I started messing around in the raw source and realized... I have no idea how to debug this codebase etc. Ideally I would like to be able to run the app.js from VS Code. I tried doing that on the installed version of the code in node_modules but it looks like it has been minified and transformed by the build process and now lives in static/ethercalc.js.map. Could you provide any docs for how I might go about debugging this project etc?
In chrome: To debug the client, I just use chrome and add breakpoints. It lets you expand minified code.
In the console type: window.spreadsheet.sheet.cells["C2"]
Server Side
The server side is much harder to debug. Adding log statements works.
It should be possible to debug server side nodejs with chrome, but I did not get it working. I have very little server side code, so I used logs.
Add a breakpoint in chome in method SocialCalc.ScheduleSheetCommands. Change the spreadsheet. Look at the stacktrace to see the flow of code. e.g.
------ Stacktrace of reload sheet with recalc & redisplay ----------- SocialCalc.ScheduleSheetCommands (ethercalc.js:formatted:1427) SocialCalc.ScheduleSheetCommands (broadcast.js:88) SocialCalc.Sheet.ScheduleSheetCommands (broadcast.js:64) SocialCalc.EditorScheduleSheetCommands (ethercalc.js:formatted:4370) SocialCalc.TableEditor.EditorScheduleSheetCommands (ethercalc.js:formatted:3978) SocialCalc.SpreadsheetControlExecuteCommand (ethercalc.js:formatted:13116) SocialCalc.SpreadsheetControl.ExecuteCommand (ethercalc.js:formatted:12446) onLoad (main.js:465) onReady (main.js:378)
Flow of calls for an ExecuteCommand statement
Edit cell
SocialCalcTableEditor.js (client)
player-broadcast.ls (client & server)
player.ls (client) (shows as main.ls in browser)
zapper.js (client)
main.ls (server)
sc.ls (server)
Re-calc after cell edit
Similar to Excel I would like to be able to write/add custom functions and macros.
Ideally I would like an IDE (maybe the chrome developer tools is enough) which allows me to view and write functions, edit them, step through them.
Would it be possible to add custom functions in the simplest implementation?