Skip to main content

15 posts tagged with "javascript"

View All Tags

Chrome TouchEvent passive 参数介绍

· 15 min read

在 Chrome 浏览器中使用以下代码:

document.body.addEventListener("touchmove", (e) => {
console.log(e);
})

会在控制台看到一个警告信息:

[Violation] Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952

GraphQL 项目搭建

· 14 min read
Alan
Maintainer of blog

本文转摘自公众号文章: GraphQL实践

随着业务的增长,页面涉及的业务线越来越多, 为了实现一个需求, 需要调用多个接口组合数据, 然后绑定到 UI 组件上. 每个接口返回的数据会有很多字段是不会使用的, 浪费了网络流量. 为了解决该问题, 我们小组引入了 GraphQL 作为 BFF 层, 利用 GraphQL 服务减少网络请求次数, 以及数据裁减能力减少网络响应数据量.

下面简单介绍一下我们组的 GraphQL Node 服务端项目的搭建过程.

异步编程简介

· 6 min read
Alan
Maintainer of blog

JavaScript

Promise

简述Promise发展历程

Promise 一词最早由一个C++工程师用在Xanadu项目中, 随后Promise被用在E语言当中, 这又激发了Python开发人员的灵感, 将它实现成了Twisted框架的Deferred对象. 2007年, JavaScript框架Dojo借鉴Twisted新增了dojo.Deferred对象. 2009年, Kris Zyp提出了CommonJS中的Promises/A规范. #1