1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        dejavu.jsJavaScript 面向?qū)ο罂蚣?/h1>

        聯(lián)合創(chuàng)作 · 2023-09-22 12:18

        dejavu 在JavaScript原型繼承的基礎(chǔ)上提供了經(jīng)典的繼承形式,使得其他語(yǔ)言開(kāi)發(fā)者可以輕松轉(zhuǎn)向JavaScript。

        dejavu 主要特性:

        • 類(具體的、抽象的、final類)

        • 接口

        • 混入(這樣你可以使用某種形式的多重繼承)

        • 私有成員和受保護(hù)成員

        • 靜態(tài)成員

        • 常量

        • 函數(shù)上下文綁定

        • 方法簽名檢查

        • 擴(kuò)展和借用vanilla類

        • 自定義instanceOf,支持接口

        • 兩個(gè)版本:普通版本和AMD優(yōu)化版本

        • 每個(gè)版本都有兩種模式:嚴(yán)格模式(執(zhí)行很多檢查)和寬松模式(無(wú)檢查)

        示例代碼:

        var Person = Class.declare({
            // although not mandatory, it's really useful to identify
            // the class name, which simplifies debugging
            $name: 'Person',
        
            // this is a protected property, which is identified by
            // the single underscore. two underscores denotes a
            // private property, and no underscore stands for public
            _name: null,
            __pinCode: null,
        
            // class constructor
            initialize: function (name, pinCode) {
                this._name = name;
                this.__pinCode = pinCode;
        
                // note that we're binding to the current instance in this case.
                // also note that if this function is to be used only as a
                // callback, you can use $bound(), which will be more efficient
                setTimeout(this._logName.$bind(this), 1000);
            },
        
            // public method (follows the same visibility logic, in this case
            // with no underscore)
            getName: function () {
                return this._name;
            }
        
            _logName: function () {
                console.log(this._name);
            }
        });
        
        瀏覽 25
        點(diǎn)贊
        評(píng)論
        收藏
        分享

        手機(jī)掃一掃分享

        編輯 分享
        舉報(bào)

        評(píng)論
        圖片
        表情
        推薦
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            超碰免费日批 | 欧美精品日本 | 美女视频黄a视频免费全程软件axs | 特黄做爰60分钟免费看 | 抽插性感美女 | 婷婷五月天综合社区在线观看 | 三级黄色毛片动作花样看看 | 嗯灬啊灬快灬高潮了视频日本无码 | 亚洲天堂在线无码 | 男女h在线观看 |