You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
추가로 찾아보니 set 함수 뿐만 아니라 모든 dayjs 오브젝트는 immutable하다.
-> immutable 프로그래밍을 하면 메모리 사용과 퍼포먼스에서 일부 손해가 발생하는 건 어쩔 수 없다. 안정성, 디버깅을 얻기 위한 트레이드 오프.
Plugin
자바스크립트는 다중 상속을 지원안함.
classMom{}classDad{}// Error "Classes can only extend a single class."classChildextendsnewMom,Dad{}
plugin으로 이를 해결. 각 플러그인은 extend 함수를 통해 DayJs 클래스의 prototype을 직접 변경하는 방식으로 다중 상속을 해결.
다만 이런 방식은 plugin을 적용하는 순서에 따라 프로퍼티, 메소드 오버라이딩이 발생할 수 있고, 기능도 달라지므로 주의 필요함.
classMom{}classDad{}// Error "Classes can only extend a single class."classChildextendsnewMom,Dad{}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
-> immutable 프로그래밍을 하면 메모리 사용과 퍼포먼스에서 일부 손해가 발생하는 건 어쩔 수 없다. 안정성, 디버깅을 얻기 위한 트레이드 오프.
자바스크립트는 다중 상속을 지원안함.
다만 이런 방식은 plugin을 적용하는 순서에 따라 프로퍼티, 메소드 오버라이딩이 발생할 수 있고, 기능도 달라지므로 주의 필요함.
Beta Was this translation helpful? Give feedback.
All reactions