Open ekoontz opened 9 years ago
Also use input.keyup() so that parsing is incremental: parser called upon every keystroke rather than just when the return key is hit. I can move this into a separate commit/PR if you prefer.
hmmm I'm a bit concerned about keyup. responses for new text aren't super fast (~1s to parse reasonably complex strings -- the default is only really fast because of an nginx cache) so I'm worried (1) about murdering my server and (2) getting out-of-order ajax responses. I like the idea of incremental updates but I'm not sure the best way to do it efficiently.
for the other refactoring, not sure what you're envisioning for other contexts, but if you wanted it to be fully reusable it might be better to pass in references to to specific elements like #svg-canvas. maybe it would make sense for the success callback to be the method which gets pulled into a separate class? that way it's not so dependent on the specific data source (the ajax call)
for ease of reuse in other contexts