Answer the question
In order to leave comments, you need to log in
What is the approach to writing js?
We are running a project, before us it was made by an office from the top 10 studios in Russia. Source codes were not given, on hand there are only obfuscated and minified js and css files. I got into js-ku and something put me in a stupor)) Here is a code example:
h = function(t) {
function e(t) {
a(this, e);
var n = o(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t));
return n.favoriteShops = {}, n.nonFavoriteShops = {}, n.$showMoreSel = $("Класс-селектора"), n.lists = {
favorite: {
selector: "#ИД-селектора",
data: n.favoriteShops
},
other: {
selector: "#ИД-селектора",
data: n.nonFavoriteShops
}
}, n
}
return s(e, t), r(e, [{
key: "init",
value: function() {
l(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "init", this).call(this)
}
}, {
key: "bindEvents",
value: function() {
l(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "bindEvents", this).call(this);
var t = this;
t.$showMoreSel.on("click", function(e) {
var n = $(this),
i = n.prev("Класс-селектора"),
a = i.data("type"),
o = t.lists[a].data,
s = i.find("Класс-селектора").length,
r = 5;
t.appendStoreItems(o, r, s, i, "list"), e.preventDefault()
})
}
},
/* и дальше идут подобные конструкции { key: имяФункции, value: реализацияФункции } */
Answer the question
In order to leave comments, you need to log in
Most likely, the developers wrote the code in ec6 and transpiled (babel and others like it) into ec5 to support IE, because. the result of transpiling ec6-> ec5 usually looks like this.
Very similar to how babel transpiles ES6 classes. (key-values are needed here because it is later fed to a special helper that handles this with Object.defineProperty to better emulate the behavior of methods in ES6 classes.)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question