These are chat archives for canjs/canjs

4th
Mar 2015
Vojtech Prikryl
@Aldredcz
Mar 04 2015 18:00

Was just diggin in lib files, this is in view/scanner.js:

// Escapes characters starting with `\`.
        clean = function (content) {
            return content
                .split('\\')
                .join("\\\\")
                .split("\n")
                .join("\\n")
                .split('"')
                .join('\\"')
                .split("\t")
                .join("\\t");
        },

You sure that's the best way how to escape chars in terms of performance?

Matthew Phillips
@matthewp
Mar 04 2015 19:27
where is that?
oh, view/scanner
probably not the best way
i wonder how often this function gets called
but you're right
PRs welcome :)
Justin Meyer
@justinbmeyer
Mar 04 2015 20:36
@Aldredcz you should really switch to stache
@Aldredcz you can check ev.batchNum
var lastBatchNum
bind("EVENT", function(ev){
  if(ev.batchNum === undefined || ev.batchNum !== lastBatchNum) { 
    lastBatchNum = ev.batchNum

    DO STUFF
 }