<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

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

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

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

          dejavu 主要特性:

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

          • 接口

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

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

          • 靜態(tài)成員

          • 常量

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

          • 方法簽名檢查

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

          • 自定義instanceOf,支持接口

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

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

          示例代碼:

          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)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)

          評論
          圖片
          表情
          推薦
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  大鸡巴操黑丝 | 亚洲男人的天堂再线观看 | 日韩无码毛片视频 | 欧美亚洲日韩中文字幕 | 夜夜嗨AV一区二区三区 |