Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

what means "a word:" before define a function in javaScript?

I have a javaScript sample: in this sample is used words and ":" before define function. what is it? please help me...

Jb.prototype = {clickButton: function (a, b, c) {
    var d = this, e = d.selected, f = d.chart, g = d.buttons, h = f.xAxis[0], i = f.scroller && f.scroller.getUnionExtremes() || h || {}, k = i.dataMin,
        j = i.dataMax, l, m = h && t(z(h.max, o(j, h.max))), p = new Date(m), n = b.type, r = b.count, i = b._range, w;
    if (!(k === null || j === null || a === d.selected)) {
        if (n === "month" || n === "year")l = {month: "Month", year: "FullYear"}[n], p["set" + l](p["get" + l]() - r), l = p.getTime(), k = o(k, Number.MIN_VALUE), isNaN(l) || l < k ? (l = k, m = z(l + i, j)) : i = m - l; else if (i)l = v(m - i, k), m = z(l + i, j); else if (n === "ytd")if (h) {
            if (j === s)k = Number.MAX_VALUE, j = Number.MIN_VALUE, q(f.series, function (a) {
                a = a.xData;
                k = z(a[0], k);
                j = v(a[a.length - 1], j)
            }), c = !1;
            m = new Date(j);
            w = m.getFullYear();
            l = w = v(k || 0, Date.UTC(w, 0, 1));
            m = m.getTime();
            m = z(j || m, m)
        } else {
            E(f, "beforeRender", function () {
                d.clickButton(a, b)
            });
            return
        } else n === "all" && h && (l = k, m = j);
        g[e] && g[e].setState(0);
        g[a] && g[a].setState(2);
        f.fixedRange = i;
        h ? h.setExtremes(l, m, o(c, 1), 0, {trigger: "rangeSelectorButton", rangeSelectorButton: b}) : (c = f.options.xAxis, c[0] = u(c[0], {range: i, min: w}));
        d.selected = a
    }
}, defaultButtons: [
    {type: "day", count: 1, text: "1d"},
    {type: "week", count: 1, text: "1w"},
    {type: "month", count: 1, text: "1m"},
    {type: "month", count: 6, text: "6m"},
    {type: "year",
        count: 1, text: "1y"},
    {type: "all", text: "All"}
]
}

what means words "clickButton" , "defaultButtons" in code?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is an object literal with function expressions in it. Do you know about object literals?

x = {asdf: 1, fdsa: 2}

will create an object with properties asdf and fdsa set to 1 and 2 respectively. The object literal in question simply has much more complex property values.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...