DEV
-
setTimeout, setInterval 인자 넘기기DEV/Javascript 2021. 6. 13. 15:45
const promise1 = () => new Promise((resolve, reject) => { setTimeout(resolve, 3000, 5); }); const promise2 = () => new Promise((resolve, reject) => { setTimeout(reject, 3000, "Could not get value"); }); 위의 코드는 Udacity - Intermediate Javascript 예시 코드 중에 발췌한 것이다. setTimeout 사용할 때 항상 나는 아래와 같은 방식으로 첫 번째 인자 안에 함수를 구구절절 넣는 방식을 사용했는데, Udacity 예제처럼 함수 따로 먼저 넣고 인자를 뒤에 줄줄이 나열해서 넣어도 좋겠다. setTimeout(() => ..
-
Promise.all vs. Promise.allSettledDEV/Javascript 2021. 6. 8. 15:17
From ECMAScript 2022 Language Specification, The allSettled function returns a promise that is fulfilled with an array of promise state snapshots, but only after all the original promises have settled, i.e. become either fulfilled or rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm. https://tc39.es/ecma262/multipage/control-abstraction-objects.html#..
-
Promise Fulfilled vs. ResolvedDEV/Javascript 2021. 6. 8. 10:50
According to the MDN Promise page, A Promise is in one of these states: * pending: initial state, neither fulfilled nor rejected. * fulfilled: meaning that the operation was completed successfully. * rejected: meaning that the operation failed. According to ECMAScript 2015 Language specification, When the Promise function is called with argument executor the following steps are taken: ... The ex..
-
구글 소프트웨어 엔지니어링(Software Engineering at Google), O'ReillyDEV/기타서적 2021. 5. 28. 14:40
https://abseil.io/resources/swe-book abseil / Software Engineering at Google An open-source collection of core C++ library code abseil.io 회사 슬랙 채널에서 누군가 공유해 준 링크인데, 따라가 보면 오라일리 출판사에서 발간한 'Software Engineering at Google' 책의 PDF 버전을 무료로 볼 수 있다. 페이지를 보면 이런 설명이 있다. The Software Engineering at Google book (“SWE Book”) is not about programming, per se, but about the engineering practices utilized at G..
-
CSS와 JS 사이에 변수 공유하기DEV/CSS 2021. 5. 3. 15:21
프론트엔드 개발을 하다 보면 각종 스타일 변수(대표적으로 컬러와 여백값)를 JS 코드에서 끌어다 써야 할 때가 있다. 생각나는 방법으로는 세가지 정도가 있다. styled-component 등 CSS-in-JS 라이브러리를 사용하는 경우: JS 코드로 정의하기 CSS 커스텀 프로퍼티로 정의해 두고 DOM API를 사용해 접근하기 css-modules 사용하는 경우: :export 사용하여 스타일 파일에서 변수 내보내기 각각의 방법을 하나씩 살펴보자! JS 코드에 객체 등으로 정리 스타일과 스크립트 코드가 섞이는 것에 그닥 불만이 없다면 적극 활용을 권장하고 싶다. 나는 그 둘 사이의 명확한 구분이 꼭 필요하다고 생각하는 타입이 아니고, 객체로 상수값 정리하는 것을 좋아해서 예전에 네이버 스마트 플레이스 ..
-
Array.prototype.map()의 세번째 파라미터DEV/Javascript 2021. 5. 3. 11:56
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map Array.prototype.map() - JavaScript | MDN Array.prototype.map() The map() method creates a new array populated with the results of calling a provided function on every element in the calling array. map((currentValue) => { ... } ) map((currentValue, index) => { ... } ) map((currentValue, index, arr developer.mozilla..
-
10 Things I Regret About Node.js - Ryan Dahl - JSConf EUDEV/Back-end 2021. 5. 1. 18:25
영어 공부 겸 번역. 라이언 달 나름 재밌는 사람이구나! https://youtu.be/M3BM9TB-8yA 안녕하세요. 음, 네, 원래는 다른거 이야기 하려고 했는데 준비가 안되었네요. 그래서 대신에 이 이야기를 하려고 합니다. 노드가 나온지 꽤 되었네요. 안정화도 되었고, 널리 알려지기도 했고. 발전하는 듯한 모양새를 보였죠. 이제는 노드에 대해 다시 생각해 보고 그 생각을 여러분께 공유해야 할 때인 것 같습니다. 배경 설명 저는 노드를 만들었고, 초기 개발 단계부터 참여해 몇 년간 운영했습니다. 그리고, 이미 아시는 분도 있을테지만, 저는 IO, 자바스크립트로 이벤트 주도 IO를 만드는데 상당히 많은 심혈을 기울였습니다. 2009년 당시 저는 이 목표가 매우 중요하다고 생각했습니다. 서버사이드 자바..
-
HTML5 Video 소개DEV/HTML 2021. 4. 28. 10:26
옛날에 네이버 광고 마크업 담당할 때, 영상 광고에서 사용할 플레이어를 만들어야 했다. 그 때 리서치 하면서 번역한 자료. HTML5 Video 소개 원문: Introduction to HTML5 Video by Bruce Lawson, Patrick H. Lauke, 11 Feb 2016 업데이트 기록 2010년 5월 14일: 사소한 변경사항 몇가지 적용함. 구글의 VP8 코덱이 사용 가능해졌다는 정보, VP8을 지원하는 Opera Labs 실험 버전이 빌드되었다는 정보 추가. 2010년 7월 1일: 다운로드 링크를 우리가 한 실험을 받아볼 수 있는 링크로 대체함. 2012년 1월 14일: webM과 H.264를 집중적으로 다루는 것으로 글을 수정함. Ogg Theora와 관련된 설명은 사이드 노트에서..