stellarchat/desktop-client

Drop jQuery dependency to reduce size

Closed this issue · 2 comments

By looking at code, there's only two places that use jQuery. As it is quite big and slow, I'd suggest to drop it.

1. blob.factory.js

It uses $.extend, which can be drop-in replaced with little helper as said here. This is easy part.

function extend(){
  for(var i=1; i<arguments.length; i++) {
    for(var key in arguments[i]) {
      if(arguments[i].hasOwnProperty(key)) {
        if (typeof arguments[0][key] === 'object'
            && typeof arguments[i][key] === 'object'
        ) {
            extend(arguments[0][key], arguments[i][key]);
        } else {
            arguments[0][key] = arguments[i][key];
        }
      }
    }
  }
  return arguments[0];
}

2. Bootstrap v3 dependency

There is bootstrap.native that is based on native Javascript with smaller footprint and better performance. Haven't used it myself, but looks worthy to try.

I could make a PR on this. What do you think about making such change?

make sense, I will check the code and have a test in my local env first

Bootstrap need jquery, so we cannot remove the dependecy.