V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
V2EX  ›  kamilic  ›  全部回复第 25 页 / 共 25 页
回复总数  494
1 ... 16  17  18  19  20  21  22  23  24  25  
2020 年 3 月 23 日
回复了 50vip 创建的主题 分享创造 面试:如何实现一个模板引擎?
可以考虑用 lit-html 啊,也是差不多的书写方式。
但是他们有类似 v-dom diff 和 patch 的效果(虽然内部实现不是 vdom )
也挺厉害的
买个箱子装一起
2020 年 1 月 12 日
回复了 0gys 创建的主题 生活 祝大家的另一半像雪花一样扑过来
广州没有雪
汤达人
2019 年 11 月 28 日
回复了 qiayue 创建的主题 推广 [特价][抽奖]赣南脐橙 5 斤试吃装包邮只要 28 元
吃个橙
2019 年 8 月 23 日
回复了 VDimos 创建的主题 程序员 这样的想法可行不?
flutter?
2019 年 7 月 18 日
回复了 chashao 创建的主题 问与答 一道 promise 的题目,求大佬解答
??不支持 md 的?
2019 年 7 月 18 日
回复了 chashao 创建的主题 问与答 一道 promise 的题目,求大佬解答
```javascript
class Scheduler {
constructor() {
this.__maxQueueSize = 2;
this.__runningJobs = [];
this.__pendingQueue = [];
}

get isJobsFull() {
return this.__maxQueueSize <= this.__runningJobs.length;
}

static jobWrapper(promiseCreator) {
Scheduler.__jobId += 1;
const id = Scheduler.__jobId;
const wrappedPromise = promiseCreator().then((result) => {
return {
id,
result
};
});
wrappedPromise.__jobId = id;
return wrappedPromise;
}

removeFinishedJob(id) {
console.log(`remove ${id}`);
this.__runningJobs = this.__runningJobs.reduce((curr, job) => {
if (job.__jobId !== id) {
curr.push(job);
}
return curr;
}, []);
console.log(this.__runningJobs);
}

async add(promiseCreator) {
if (!this.isJobsFull) {
const job = Scheduler.jobWrapper(promiseCreator);
this.__runningJobs.push(job);
const {result, id} = await job;
this.removeFinishedJob(id);
return result;
} else {
this.__pendingQueue.unshift(promiseCreator);
await Promise.race(this.__runningJobs);
if (this.__pendingQueue.length > 0) {
return this.add(this.__pendingQueue.pop());
}
}
}
}

Scheduler.__jobId = 0;
```

昨晚一时兴起写了一下,希望对你有帮助。。
没得选 家就在一线
而且并不是某村村民
2019 年 5 月 24 日
回复了 kassol 创建的主题 全球工单系统 淘宝 npm 镜像源貌似挂了
又挂了
2019 年 4 月 7 日
回复了 gazce 创建的主题 Apple 就在刚刚,终于打通了 apple 的客服电话。
@BenX AC+ 可以退吗? 我前几天打过电话给客服,他们说服务类的不能退
为什么总觉得土著就是有钱的呢
1 ... 16  17  18  19  20  21  22  23  24  25  
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1025 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 67ms · UTC 18:52 · PVG 02:52 · LAX 11:52 · JFK 14:52
♥ Do have faith in what you're doing.