티스토리 뷰

frontend and javascript

  • 클라이언트 환경 개선
  • 웹브라우저 표준화(ecma)
  • Tech Stack
  • Package(webpack and CLIs)

why not javascript, why typescript

PAHSER arounding

Tips

javascript

  • 매우 빠르게 변화 중임
  • unlimited free
    • CAN runtime member add
    • CAN runtime change val type
    • CAN closure
    • all is function, not native type
      • function is first class 'object' or 'function'
      • so class is function
      • so object is function
  • but it is not free
    • hell gate 'call back hell'
    • Polyfill
      • use babel
      • source import
      • arrow function(=>) ie 문제
      • .prototype.includes - ie문제
  • so use ecma6 and babel
    • async/await
  • size is performance
    • script parsing time
    • engine runtime
  • super many modules
  • be friend MDN

typescript

javascript and typescript code

  • using recommand include type - babel
    • ecma6 이후 표준으로 명기 되어 있고 앞으로 브라우저들이 지원할 예정
    • babel transpiler 사용하면 현재도 사용가능
import $ from 'jquery';
import _ from 'lodash';
import * as momnet from 'monent';
  • can use 'any type' but use 'define type'
function add(a, b);
function add(a: number, b: number); // use this
  • map do not use '[]', use 'get'
let map = new Map<string, number>();
map.set('magic', 23445);
let badVal = map['magic']; // not runtime error, bun not work
let goodVal = map.get('magic'); // good 23445
  • import와 export
// from X.ts
export class X { }
// target.ts
import { X } from 'X.ts';
// or
import * as Util from 'X.ts';

// from Y.ts
export default class Y { }
// target.ts
import Y from 'Y.ts';

node/npm

phaser

  • Sound Load 문제 - ie11 문제
    • 순차 로딩을 해야함 로딩이 완료 되고 다음 로딩을 해야함
game.load.audio('n', ['audio/a.mp3', 'audio/a.ogg']);
game.load.onLoadComplete.add(soundloadFunction, this); // 끝나고 다시 로딩 호출 - 코드상으로 재귀 스택오버플로우 주의
game.load.start();

etc

  • use webpack!
  • use CLI
  • 신중히 기술 스택을 정하세요.
  • 계속 갱신하시고
  • fe의 즐거움 호환성 'IE'


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함