# extends
interface IOption {
id: number;
}
interface IA<T extends IOption> {
init:(option: T) => void;
}
interface IAOption extends IOption{
a: number;
}
class A implements IA<IOption> {
init(option: IOption){}
}
interface IB extends IA<IAOption> {
init:(option: IAOption) => void;
}
class B extends A implements IB {
init(option: IAOption){}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# peer dependencies
npm versions 1, 2, and 7 will automatically install peerDependencies if they are not explicitly depended upon higher in the dependency tree. For npm versions 3 through 6, you will receive a warning that the peerDependency is not installed instead.
# app link
- shema
when app installed, the app will add one custome protocol into ios system. like weixin://. But this method will be forbidened by some app and is not smooth enough
iOS users can tap a link to your website and get seamlessly redirected to your installed app without going through Safari. If your app isn’t installed, tapping a link to your website opens your website in Safari.
Create an apple-app-site-association file that contains JSON data about the URLs that your app can handle.
Upload the apple-app-site-association file to your HTTPS web server. You can place the file at the root of your server or in the .well-known subdirectory.
Prepare your app to handle universal links.
# bisect
git bisect start
can start a quick find for git commit
git bisect bad/old
tag current commit as a bad code
git bisect good/new commit-1
tag commit-1 commit as a good code
and from now, git will automatical checkout to middle commit,and you need to tag good or bad untill you find the bug
git bisect reset
will end this debug
# 300ms tap delay
<meta name="viewport" content="width=device-width">
# CSP
https://developers.google.com/web/fundamentals/security/csp?hl=zh-cn
only load code from specific uri
script-src https://host1.com https://host2.com
or with default-src
Content-Security-Policy: default-src https://cdn.example.net; child-src 'none'; object-src 'none'
at first, you can use Content-Security-Policy-Report-Only
script-src 'unsafe-eval'
will enabel evel Function
script-src 'unsafe-inline'
will enabel inline script
# isPointInStroke isPointInPath
"path" will use close path (if path not close, it will use ctx.closePath automatically)
"stroke" will detect the real pixel stroke
# npm deprecate
to info users warning
# lerna skip changed check
--force-publish
# mobile browser event quene
touchstart touchend mousemove mousedoen mouseup click
# git delete latest tag
git tag -d $(git log --date-order --tags --simplify-by-decoration --pretty=format:'%d' | head -1 | tr -d '()' | sed 's/,* tag://g')
# reset first git commit
git update-ref -d HEAD
update-ref (opens new window)
you need to delete current branch and push force again
# git delete origin tag
git push origin --delete <tagname>
# lerna: skip partial packages using leran publish
lerna did support lerna run xxx --scope pkg1
. but scope
do not work when using publish
there has a lot of issues about this, but none of them mentioned how to solve it, cause the maintainer insist that
Because it breaks the fundamental mechanism Lerna uses to determine which packages need to be published? Absolutely nothing stopping you from not placing several packages in the same monorepo that apparently shouldn't be.
------ @evocateur
As I noted above, this is impossible due to the manner in which lerna coordinates versions with git tags (and the diff since the last one is what indicates which packages should be published). ------ @evocateur
If they are both independent, and you don’t want to publish them at the same time, then don’t use lerna, it’s clearly not necessary for your use case. ------ @evocateur
until..... I fonud this_commit (opens new window)
I test the lerna publish --no-private
, it did work for me on version 3.22.1
but stil lerna publish --help
did not show this config 😃
# yarn workspace nohoist
workspaces looks good. but sometimes it's not so that smart. it juset can't completely figure out the package should place in the root node_modules or the child project node_modules
so like the artificial intelligence, it need some help.
// root project package.json
"workspaces":{
"packages": ["./A","./B"],
"nohoist": ["**/react-native"]
},
// child project package.json
"workspaces": {
"nohoist": ["react-native", "react-native/**"]
}
2
3
4
5
6
7
8
9
# unhandledRejection
In frontend project, sometimes, somehow, there will be somewhy error like unhandledRejection
but this error do not show where it is 😦
so with the code below, you can catch them easily!
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
});
2
3
# disable .ds_store auto generated in mac
.DS_Store (opens new window) defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
# make alias with zsh
alias [custom-alias]="[command]"
example
alias devbox="ssh [email protected]"
# dyld brew
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
Referenced from: /usr/local/bin/node
Reason: image not found
2
3
this problem is causing by error link node version. you can use brew upgrade node
or brew upgrade
to upgrade all packages.