Comments (3)
function b () {
let i = 0;
while(true){
console.log('in');
i++;
if (i % 1000 === 0) {
new Promise((res) => {
setTimeout(() => {
console.log('ok');
}, 3000);
})
}
}
console.log('out');
}
이 함수에서 내부의 setTimeout이 있는 Promise는 동작하지 않는다. 호출 스택에 있을 b가 끝나지 않기 때문이다. setTimeout의 시간에 도달한다고 하더라도, 호출 스택이 비지 않으면 이벤트 루프는 이벤트 큐의 함수를 호출 스택으로 내보내지 않는다.
from til.
오랜만에 봐도 좋은 글이다.
from til.
회사 내에 배포되어 있는 라이브러리를 보고 npm Pro 결제 없이도 private하게 라이브러리를 배포할 수 있는 걸 알았다.
배포할 패키지가 있는 레포지토리에서 package.json에 pubhlishConfig를 추가 하고, .npmrc 파일을 만들어서 아래와 같이 내용을 추가한다.
// 배포하려는 라이브러리 쪽 package.json
{
"name": "@username/repositoryName",
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
...
}
# 배포하려는 라이브러리 쪽 .npmrc
@username:registry=https://npm.pkg.github.com/
이후에 패키지를 다운 받는 쪽에서도 .npmrc 파일을 추가하여 해당 패키지만 github packages에서 install될 수 있도록 하면 된다.
만약 install에 실패하는 경우, private repository기 때문에 접근 권한이 없어서 일 수 있다.
npm login --registry https://npm.pkg.github.com/
이 경우 npm login을 해두면 된다. ( --auth-type=legacy 는 이제 먹히지 않는 듯 하다. 패스워드 대신 github accessToken을 사용하자. )
reference
npm, github의 username, organization name이 같다면?
from til.
Related Issues (11)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from til.