Aurelia-CLI ํ๋ก์ ํธ์์ THREE๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค. ์ด๋ ๋ชจ๋๊ณผ RequireJS๋ฅผ ์ฌ์ฉํ์ฌ๋ก๋๋์์์ ์๋ฏธํฉ๋๋ค. Internet Explorer (IE 11์์ ํ ์คํธ ๋จ)๋ฅผ ์ ์ธํ๊ณ ๋ ๋ชจ๋ ์ ์๋ํฉ๋๋ค.
์ค๋จ๋๋ ์ฝ๋๋ /build/three.js ํ์ผ์ ๋ค์ (๋งจ ์์ polyfill ์น์ 42-57 ํ)์ ๋๋ค.
if ( Function.prototype.name === undefined ) {
// Missing in IE
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name
Object.defineProperty( Function.prototype, 'name', {
get: function () {
return this.toString().match( /^\s*function\s*([^\(\s]*)/ )[ 1 ];
}
} );
}
can't redefine non-configurable property "name"
์ค๋ฅ๋ฅผ ๋ฐํํฉ๋๋ค.
์ด ๊ฒ์๋ฌผ์ ๋ฐ๋ผ ์์ ์ฝ๋๋ฅผ ๋ค์๊ณผ ๊ฐ์ด ๋ฐ๊พธ๋ ค๊ณ ํ์ต๋๋ค.
if (!(function f() {}).name) {
Object.defineProperty(Function.prototype, 'name', {
get: function() {
var name = (this.toString().match(/^function\s*([^\s(]+)/) || [])[1];
// For better performance only parse once, and then cache the
// result through a new accessor for repeated access.
Object.defineProperty(this, 'name', { value: name });
return name;
}
});
}
๊ทธ๋ฆฌ๊ณ ๊ทธ๊ฒ์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํฉ๋๋ค!
=> ํ์ฌ /build/three.js์์ ์ฌ์ฉ๋๋ polyfill ์ฝ๋๊ฐ ์ ์๋ํ์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค. ํฅํ ๋น๋๋ฅผ ์ํด์ด ์ฝ๋๋ฅผ ๋์ฒด ํ ์ ์์ต๋๊น?
์ํ๋ฅผ ๋ณ๊ฒฝํ๋ฉด ์ฐจ์ด๊ฐ ์์ต๋๊น?
if ( 'name' in Function.prototype === false ) {
๋๋
if ( Function.prototype.hasOwnProperty( 'name' ) === false ) {
if
๋ง ๋ณ๊ฒฝํ๋ฉด ์ถฉ๋ถ ํจ์ ํ์ธํฉ๋๋ค.
if ( 'name' in Function.prototype === false ) {
๊ฐ ๊ธธ!
๊ฒฐ์ ๋. ๊ฐ์ฌ!
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
if
๋ง ๋ณ๊ฒฝํ๋ฉด ์ถฉ๋ถ ํจ์ ํ์ธํฉ๋๋ค.๊ฐ ๊ธธ!