Skip to content

heyyong/jsInherit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsInherit

一个简单的继承实例

会将

function A() {
    this.a = 12;
}

function B__extends__A() {
    this.b = 12;
}

当作继承来看待,编译结果为:

function A() {
  this.a = 12;
}

function B() {
  function __inheritProrotype(subType, superType) {
    var prototype = Object.create(superType.prototype);
    prototype.constructor = subType;
    subType.prototype = prototype;
  }

  var __args;

  for (var __i in arguments) {
    __args[i] = arguments[i];
  }

  __inheritProrotype(B, A);

  A.call(this, __args);
  this.b = 12;
}

使用

yarn build

来进行编译

About

简单的继承编译机制

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published