'Programming/javascript & HTML'에 해당되는 글 138건

  1. 2023.04.06 javascript 정수는 정수가 아니다
  2. 2023.04.04 websocket binarytype
  3. 2023.03.13 자바스크립트 소수점 자르기
  4. 2023.02.07 Math.min.apply()
  5. 2022.12.22 web 렌더러 벤치마크
  6. 2019.06.04 웹에서 f5 갱신 막기
  7. 2019.06.03 cose network graph
  8. 2019.04.26 HTTP 302 redirect
  9. 2019.04.24 closure
  10. 2019.04.23 iife (Immediately Invoked Function Expression)

내부적으로 이렇게 처리할 줄이야..

 

A number literal like 37 in JavaScript code is a floating-point value, not an integer. There is no separate integer type in common everyday use. (JavaScript also has a BigInt type, but it's not designed to replace Number for everyday uses. 37 is still a number, not a BigInt.)

[링크 : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number]

'Programming > javascript & HTML' 카테고리의 다른 글

canvas 없는 getcontext  (0) 2023.07.12
html canvas와 시간 그래프 흘리기  (0) 2023.07.06
websocket binarytype  (0) 2023.04.04
자바스크립트 소수점 자르기  (0) 2023.03.13
Math.min.apply()  (0) 2023.02.07
Posted by 구차니

웹 브라우저에서 웹 소켓을 열면 기본값은 blob 으로 열리는데

Value
A string:

"blob"
Use Blob objects for binary data. This is the default value.

"arraybuffer"
Use ArrayBuffer objects for binary data.

 

binaryType을 지정하면 blob이 아닌 arraybuffer로 열 수 있다.

// Create WebSocket connection.
const socket = new WebSocket("ws://localhost:8080");

// Change binary type from "blob" to "arraybuffer"
socket.binaryType = "arraybuffer";

[링크 : https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/binaryType]

 

웹 소켓에서 blob이나 arraybuffer로 받는데

blob은 slice를 통해 자를수 있긴 한데 이래저래 행렬 처리가 아니다 보니 번거롭고

개인적인 취향으로는 blob을 받아서 arraybuffer로 변환하기 보다는 arraybuffer로 받아서 적당히 잘라쓰는 쪽 일 듯

blob은 contentType을 멀 지정해야 하나 조금 귀찮은 듯.. (타입이다 보니 int32, float64 이런게 아닐 것 같으니)

Syntax
slice()
slice(start)
slice(start, end)
slice(start, end, contentType)

[링크 : https://developer.mozilla.org/en-US/docs/Web/API/Blob/slice]

 

Convert an ArrayBuffer or typed array to a Blob
#
var array = new Uint8Array([0x04, 0x06, 0x07, 0x08]);
var blob = new Blob([array]);

[링크 : https://riptutorial.com/javascript/example/1390/converting-between-blobs-and-arraybuffers]

[링크 : https://velog.io/@chltjdrhd777/ArrayBuffer-와-Blob]

[링크 : https://heropy.blog/2019/02/28/blob/]

 

strToAB = str =>
  new Uint8Array(str.split('')
    .map(c => c.charCodeAt(0))).buffer;

ABToStr = ab => 
  new Uint8Array(ab).reduce((p, c) =>
  p + String.fromCharCode(c), '');

console.log(ABToStr(strToAB('hello world!')));

[링크 : https://stackoverflow.com/questions/39725716/]

[링크 : https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Int32Array]

 

[링크 : http://mohwa.github.io/blog/javascript/2015/08/31/binary-inJS/]

 

'Programming > javascript & HTML' 카테고리의 다른 글

html canvas와 시간 그래프 흘리기  (0) 2023.07.06
javascript 정수는 정수가 아니다  (0) 2023.04.06
자바스크립트 소수점 자르기  (0) 2023.03.13
Math.min.apply()  (0) 2023.02.07
web 렌더러 벤치마크  (0) 2022.12.22
Posted by 구차니

'Programming > javascript & HTML' 카테고리의 다른 글

javascript 정수는 정수가 아니다  (0) 2023.04.06
websocket binarytype  (0) 2023.04.04
Math.min.apply()  (0) 2023.02.07
web 렌더러 벤치마크  (0) 2022.12.22
웹에서 f5 갱신 막기  (0) 2019.06.04
Posted by 구차니

배열에서 최소, 최대값 계산하기 함수

 

Math.min.apply(null, arr)
Math.max.apply(null, arr)

[링크 : https://rutgo-letsgo.tistory.com/96]

 

Syntax
apply(thisArg, argsArray)

Parameters
thisArg
The value of this provided for the call to func. If the function is not in strict mode, null and undefined will be replaced with the global object, and primitive values will be converted to objects.

argsArray Optional
An array-like object, specifying the arguments with which func should be called, or null or undefined if no arguments should be provided to the function.

[링크 : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply]

'Programming > javascript & HTML' 카테고리의 다른 글

websocket binarytype  (0) 2023.04.04
자바스크립트 소수점 자르기  (0) 2023.03.13
web 렌더러 벤치마크  (0) 2022.12.22
웹에서 f5 갱신 막기  (0) 2019.06.04
cose network graph  (0) 2019.06.03
Posted by 구차니

현재 사용중인 컴퓨터(i5-10210U) 에서 해보니

2000개(기본값 기준)

27~32 fps svg

42~48 fps canvas

60~61 fps webgl(아마도.. 측정불가?)

 

10000개

6~7 fps svg

11~12 fps canvas

60~61 fps webgl(아마도.. 측정불가?)

 

[링크 : https://ahoak.github.io/renderer-benchmark/]

   [링크 : https://github.com/ahoak/renderer-benchmark]

 

최적화 방법에 따라 달라지지만

SVG < canvas < webGL 순서로 성능이 올라가는 듯.

 

[링크 : https://www.yworks.com/blog/svg-canvas-webgl]

[링크 : https://blog.scottlogic.com/2020/05/01/rendering-one-million-points-with-d3.html]

'Programming > javascript & HTML' 카테고리의 다른 글

자바스크립트 소수점 자르기  (0) 2023.03.13
Math.min.apply()  (0) 2023.02.07
웹에서 f5 갱신 막기  (0) 2019.06.04
cose network graph  (0) 2019.06.03
HTTP 302 redirect  (0) 2019.04.26
Posted by 구차니

키코드로 막기

 

<script>

     window.onload = function () {
        document.onkeydown = function (e) {
            return (e.which || e.keyCode) != 116;
        };
    }

</script>

[링크 : https://www.aspsnippets.com/.../Disable-F5-Key-Button-and-browser-refresh-....aspx]

[링크 : https://www.c-sharpcorner.com/blogs/disable-f5-key-button-and-browser-refresh]

[링크 : https://zetawiki.com/wiki/웹브라우저_백스페이스,_F5_입력_막기]

 

1. window.onbeforeunload (calls on Browser/tab Close & Page Load)

2. window.onload (calls on Page Load)

[링크 : https://stackoverflow.com/questions/8013429/how-do-i-detect-a-page-refresh-using-jquery]

'Programming > javascript & HTML' 카테고리의 다른 글

Math.min.apply()  (0) 2023.02.07
web 렌더러 벤치마크  (0) 2022.12.22
cose network graph  (0) 2019.06.03
HTTP 302 redirect  (0) 2019.04.26
closure  (0) 2019.04.24
Posted by 구차니

 

The cose (Compound Spring Embedder) layout uses a physics simulation to lay out graphs. It works well with noncompound graphs and it has additional logic to support compound graphs well.

[링크 : http://js.cytoscape.org/]

 

[링크https://visjs.org/network_examples.html]

[링크http://jsnetworkx.org/]

[링크https://graphalchemist.github.io/Alchemy/#/examples]

[링크https://zoomcharts.com/.../network-graph-nodes-with-custom-thumbnails.html]

'Programming > javascript & HTML' 카테고리의 다른 글

web 렌더러 벤치마크  (0) 2022.12.22
웹에서 f5 갱신 막기  (0) 2019.06.04
HTTP 302 redirect  (0) 2019.04.26
closure  (0) 2019.04.24
iife (Immediately Invoked Function Expression)  (0) 2019.04.23
Posted by 구차니

프록시 만들어 보다보니

그냥 사용중에는 티가 안나는데 저장된 파일은 단순하게 http meta equiv도 없이 리다이렉션 되서 찾아봄

 

 

[링크 : https://www.netmanias.com/.../cdn-http-network-protocol/http-redirection-using-302-found]

[링크 : https://developer.mozilla.org/ko/docs/Web/HTTP/Status/302]

'Programming > javascript & HTML' 카테고리의 다른 글

웹에서 f5 갱신 막기  (0) 2019.06.04
cose network graph  (0) 2019.06.03
closure  (0) 2019.04.24
iife (Immediately Invoked Function Expression)  (0) 2019.04.23
javascript 배열 초기화(벤치마크)  (0) 2019.04.12
Posted by 구차니

클로저 듣긴했는데 머더라?

 

 

[링크 : https://hyunseob.github.io/2016/08/30/javascript-closure/]

'Programming > javascript & HTML' 카테고리의 다른 글

cose network graph  (0) 2019.06.03
HTTP 302 redirect  (0) 2019.04.26
iife (Immediately Invoked Function Expression)  (0) 2019.04.23
javascript 배열 초기화(벤치마크)  (0) 2019.04.12
js 난독화  (0) 2019.03.14
Posted by 구차니

요게.. 람다랑 같은건지 다른건지 모르겠네?

 

[링크 : https://velog.io/@doondoony/javascript-iife]

[링크 : http://chanlee.github.io/2014/01/11/understand-javascript-iife/]

[링크 : http://jdub7138.blog.me/221027225353]

'Programming > javascript & HTML' 카테고리의 다른 글

HTTP 302 redirect  (0) 2019.04.26
closure  (0) 2019.04.24
javascript 배열 초기화(벤치마크)  (0) 2019.04.12
js 난독화  (0) 2019.03.14
HTML video 태그 loop 와 webalizer hit  (0) 2019.02.28
Posted by 구차니