안드로이드 웹 뷰에 HTML 로드하기

안드로이드 앱에 내가 만든 THREE.JS 뷰어를 로드 해야할 일이 생겼다.

threejs 캔버스가 들어간 HTML파일을 준비하고 다음과 같이 로드 해주면 된다. 단, 안드로이드 웹 앱에서 자바스크립트를 실행하려면 다음과 같은 설정이 필요하다.

webView.addJavascriptInterface(this, "android");
webView.loadUrl("javascript:android.onData(functionThatReturnsSomething)");


참고

https://blog.naver.com/urbanbaseinc/221672052557

https://stackoverflow.com/questions/3298597/how-to-get-return-value-from-javascript-in-webview-of-android

Nuxt build config

https://v2.nuxt.com/docs/configuration-glossary/configuration-target/

nuxt (vue) 를 정적 사이트 ( index.html ) 형태로 빌드 하고 싶다면 다음의 옵션을 조정하면 된다.

// nuxt.config.js
export defulat {
   target: "static",  // server 를 바꾼다.
   ssr: false,        // true 
   ...
}

+ 추가사항 ) nuxt 는 SSR 이기 때문에 각 모듈을 렌더링 타임에 link 하는 방식으로 동작하여 완벽한 방식은 아니다

따라서 컴팩트한 html 을 원할 경우 SSR 이 아닌 다른 Front end 프레임워크 ( vue, flutter 등.. ) 을 사용하는게 좋다.

Differences retain context between arrow function and regular function

class Test {
  constructor() {
    this.func1 = () => {
      // use keyword 'this' on the event handler
    }
  }
  
  func2() {
    // doesn't use keyword 'this' on the event handler
  }
}

The differences between `func1` and `func2` in the provided JavaScript code relate to how they handle the context of the `this` keyword. Let’s break down the differences step by step.

1. **Arrow Function vs Regular Function:** `func1` is defined using an arrow function (`() => { … }`), whereas `func2` is defined using a regular function (`function() { … }`). Arrow functions capture the surrounding context, including the value of `this`, while regular functions have their own `this` binding that is determined by how the function is called.

2. **Binding of `this`:** In `func1`, since an arrow function is used, the value of `this` inside `func1` will refer to the instance of the `Test` class where `func1` is defined. This means that no matter where `func1` is called, the `this` context remains the same as the instance of the class. Arrow functions don’t have their own `this` context; they inherit it from their enclosing function (or in this case, the constructor). In `func2`, since a regular function is used, the value of `this` will depend on how `func2` is called. If `func2` is called as a method of the `Test` instance (`testInstance.func2()`), then `this` will refer to the instance. However, if `func2` is extracted and called in a different context (e.g., as a standalone function), the value of `this` can change, possibly leading to errors or unintended behavior.

3. **Usage in Event Handlers:** If you intend to use these functions as event handlers, `func1` might be more convenient. Since it’s an arrow function, it retains the instance context, ensuring that you can use the `this` keyword inside the event handler to refer to the instance of the class. On the other hand, if you use `func2` as an event handler, the value of `this` might change based on how the event is triggered, potentially leading to unexpected results or errors.

In summary, the key difference between `func1` and `func2` lies in how they handle the `this` keyword, with `func1` using an arrow function to maintain the instance context and `func2` relying on the standard function’s `this` binding, which can be influenced by how it’s called.

크롬에서 웹페이지 전체 캡쳐

웹 페이지 상에 보여지는 부분만 캡쳐하는 것이 아닌 포함하는 웹페이지 전체영역을 한번에 캡쳐하는 방법이 있다.

이 방법은 크롬, 엣지에서만 사용 할수 있다.

  • 브라우저 정보
    Chrome(115.0.5790.111)
    Edge (115.0.1901.188)

방법은 다음과 같다.

  1. 캡쳐할 웹페이지에 접속한다.
  2. F12 키를 눌러 개발자 도구창을 열어준다.
    • 크롬 : 설정 > 도구 더보기 > 개발자 도구
    • 엣지 : 설정 > 기타 도구 > 개발자 도구 ( Ctrl + Shift + I )
  3. Ctrl + Shift + P 를 열어 명령어 창을 연다.
  4. 명령어 입력 박스에 “스크린샷” 이라고 입력한다. 영문 브라우저 일 경우 “Screenshot”
  5. “원본 크기 스크린샷 캡쳐” 메뉴를 클릭한다. 영문 브라우저 일 경우 “Full Size Screenshot”
  6. 페이지 캡쳐 이미지가 내 컴퓨터로 다운로드 된다.

주식 이야기 1

토스 주식창에서 배당주 검색을 하다가 시티즌 파이낸셜이란 회사를 발견 했다.

금융 주식같은데 올해 상반기 재무실적을 보면 살짝 줄어들고 있는걸 확인했는데 반대로 주식은

작년 초반에 비해 무려 40%가량 떨어진 가격에서 횡보 하고 있는 것으로 보인다.

무엇때문에 떨어지다 다시 오르고 있는 걸까?

초이스 스탁에 내용을 살펴보니 해당 업종 독점이 상당한 것으로 보인다. 최근에 미국에서 뱅크런 사건이 연이어 터지고 있다는 뉴스를 많이 접하는데 그래서 그런걸까? 경쟁사들이 알아서 떨어져 나가 주니 나머지 재무가 탄탄한 은행들이 반사이익을 보고 있는 게 아닐까 싶다.

총 자산을 연단위로 봤을때 자산이 늘어나고 있어서 꽤 괜찮아 보이는데 금융쪽은 지식이 전혀 없어서 이게 들어가는게 맞는지 모르겠다. 해당 주식에 대한 토스 주식이나 각 사이트에 적혀있는 의견은 적극 구매라 이번달 월급이 들어오면 살짝 담가볼까 싶다.

여태까지 구입한 주식들이 거의 기술주 여서 다른 종목도 한번 경험해 보는 것도 나쁘지 않을 것 같다. 물론 내가 보기에 현재 상태가 매력적으로 보이기도 하고.. 여전히 분석에 대한 사이트는 전무해서 감으로 계속 해나가지 싶다.