スクロール禁止にする
この記事に詳細は書いてある。
touchmoveをaddEventListenerしてpreventDefaultする。その際にpassive:falseを指定する必要がある。
function handleTouchMove(event:TouchEvent){ console.debug("touchmove.noScroll prevent.."); event.preventDefault(); } /// ひとまず一律スクロール禁止にする。 console.debug("setup touchmove.noScroll prevent.."); document.addEventListener('touchmove', handleTouchMove, { passive: false }); // document.removeEventListener('touchmove', handleTouchMove, { passive: false });
中身が空のフォルダになる
Sorcetreeでcloneしたところ、中身が入っていないフォルダができることがあった。
warning: templates not found が出ていた。以下をみると重たいかららしいが、今回は他のブランチをチェックアウトした。
apatcheの使い方
macで初歩的な使い方を忘れていたのでメモしておく。
入っているか
httpd -v
開始
sudo apachectl start sudo apachectl restart
動いているか
ps aux | grep httpd
設定、ドキュメントルートなどは
httpd.conf
ファイルにある。
rxjsで購読を止める
色々やり方はあると思うが一つ聞いたのはこういうもの。
const root = new BehaviorSubject<"start"|"end">("start"); const subject = new Subject<string>(); const op = root.pipe(mergeMap((x) => { if (x == "end") { return throwError(new Error("end")); } return subject; })).pipe() op.subscribe((x) => { console.log("1:"+x); },(e) => { console.log("1:"+e); }) subject.next("a"); subject.next("b"); root.next("end"); root.next("start"); op.subscribe((x) => { console.log("2:"+x); },(e) => { console.log("2:"+e); }) subject.next("c"); subject.next("d"); root.next("end"); root.next("start"); subject.next("e"); subject.next("f"); /* 1:a 1:b 1:Error: end 2:c 2:d 2:Error: end */
keyofのtips
const myMap = <const>{ A:{hoge:"a"}, B:{hoge:"b"} }; type keys = keyof typeof myMap;`
keysはA|Bという型になる。 ちなみにmyMapはreadonly属性になってる。
認証関連
manifest.jsonが401で認証通らず読み込めないのはcrossOrigin="use-credentials"をつけないといけないからのようだ。
https://developer.mozilla.org/ja/docs/Web/HTML/Attributes/crossorigin
型のプロパティを拡張する。
型で条件付きで拡張すれば良い。
const MyEmpty = Symbol("MyEmpty"); type Empty<T> = { [P in keyof T]:P extends "hoge" ? T[P] | typeof MyEmpty : T[P] } type ExRoomInfo = Empty<RoomInfo>
サブモジュールがクローンされない。
以下を参照した。
gitでクローンと同時にサブモジュールを初期化、アップデートする – IsaB
cloneしてから
git submodule update --init --recursive
で良いようだ、 それかそもそも
--recursive
をつけてcloneしておく。