Object.create
과 Object.setPrototypeOf
을 모두 사용할 수 있습니다.
수정 ExtendScript 실제로 Object.create
를 들어, MDN에서 볼 수 있듯이 버전 5
에서 사용할 수있는 모든 자바 스크립트 기능이없는 ECMA 스크립트 3, 사용 :
초기 정의를. JavaScript 1.8.5에서 구현되었습니다.
그리고 Object.setPrototypeOf
에 대한
: 초기 정의는 새로운 기능과 같은
Object.create
을 지원하는 polyfill을 만들 수 있습니다, 때로는 MDN 그 polyfills을 제공하는 많은 기능을 위해, 2015 년
그러나 ECMA 스크립트에 있었다 :
Object.create
polyfill :
if (typeof Object.create != 'function') {
Object.create = (function(undefined) {
var Temp = function() {};
return function (prototype, propertiesObject) {
if(prototype !== Object(prototype)) {
throw TypeError(
'Argument must be an object, or null'
);
}
Temp.prototype = prototype || {};
var result = new Temp();
Temp.prototype = null;
if (propertiesObject !== undefined) {
Object.defineProperties(result, propertiesObject);
}
// to imitate the case of Object.create(null)
if(prototype === null) {
result.__proto__ = null;
}
return result;
};
})();
}
Object.setPrototypeOf
polyfill :
Object.setPrototypeOf = Object.setPrototypeOf || function(obj, proto) {
obj.__proto__ = proto;
return obj;
}
P.S. @Ozan으로
는 대소 문자를 구분하기 때문에 Object.create를 사용하여 시도 지원하지 않습니다. – Ozan
코드를 게시 해주십시오. 구문 문제 인 것 같습니다. – Charles
재생 해 주셔서 감사합니다. 다시 코드는 다른 프로그램에서 After Effects로 애니메이션을 내보내도록 다른 사람이 작성했습니다. 링크 : http://n4te.com/x/1964-DRdD.txt – RandomTK