Call me Ishmael.

Development

프로그래밍 관련 전반에 대한 글을 다룹니다.

길지 않은 내용은 목록에서 간략한 메모 형태로 표시됩니다.

Hls.js 이벤트 흐름

Development

attachMedia 시도 시 hlsMediaAttaching Object { media: video#video } hlsMediaAttached Object { media: video#video } hlsBufferReset hlsManifestLoading Object { url: “hls streaming …

더 보기

가격 표시하기

 1toLocaleString()
 2toLocaleString(locales)
 3toLocaleString(locales, options)
 4
 5var number = 123456.789;
 6
 7// request a currency format
 8console.log(number.toLocaleString('de-DE', { style: 'currency', currency: 'EUR' }));
 9// → 123.456,79 €
10
11// the Japanese yen doesn't use a minor unit
12console.log(number.toLocaleString('ja-JP', { style: 'currency', currency: 'JPY' }))
13// → ¥123,457
14
15// limit to three significant digits
16console.log(number.toLocaleString('en-IN', { maximumSignificantDigits: 3 }));
17// → 1,23,000
18
19// Use the host default language with options for number formatting
20var num = 30000.65;
21console.log(num.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}));
22// → "30,000.65" where English is the default language, or
23// → "30.000,65" where German is the default language, or
24// → "30 000,65" where French is the default language

천의 자리 단위로 쉼표 끊어줄 때 사용.

10000000 → 10,000,000

문자열 텍스트인 경우 parseInt 를 거쳐야 한다.

MEMO

HTTP 통신 시 유의할 점(API/Webview 등)

Cleartext HTTP traffic to www.xxxxxx.com not permitted

위와 같은 에러가 난다면 수정해야 할 것이 있다

Android Pie부터 cleartext HTTP가 비활성화 되어 있으므로 활성화를 시켜주어야 통신이 가능하다

AndroidManifest의 application내부에 android:usesClreartextTraffic="true"로 지정하면 된다

그 외 세부 사항은 출처 참고.

iOS의 경우도 HTTP를 기본적으로 지원하지 않는다. .plist파일을 수정하여야 한다.

App Transport Security Settings 항목을 추가하고 하부 아이템에 Allow Arbitary Loads in Web Content를 YES로 지정한다.