小编Jos*_*osh的帖子

在 Chrome / Webkit 中禁用抗锯齿功能

有没有办法在 Chrome/Webkit 中禁用图像的抗锯齿功能?出于性能原因,我不希望浏览器平滑大于实际文件的图像。

Chrome/Safari 中的图像插值模式?一年半前就提到了这个问题,所以希望 Webkit 从那时起就添加了某种支持。

编辑:经过进一步研究,在画布(和img)上使用最近邻和CSS缩放似乎更深入,但不清楚到底是什么有效。

performance interpolation webkit google-chrome antialiasing

6
推荐指数
0
解决办法
2795
查看次数

需要帮助修复或抑制此 TypeScript 错误:TS2742

我在反应本机项目中有这个文件:

import styled, { withTheme } from 'styled-components';
import { BaseText } from '../BaseText';

export interface BodyProps {
  textAlign?: string;
  fontSize?: string;
}

export const Body = withTheme(styled(BaseText)<BodyProps>`
  text-align: ${props => (props.textAlign ? props.textAlign : 'center')};
  font-size: ${props => (props.fontSize ? props.fontSize : '16px')};
`);
Run Code Online (Sandbox Code Playgroud)

withTheme我将 React Native 从 0.61.5 升级到 0.63.2,并开始在使用的任何地方出现此 lint 错误:

TS2742:如果不引用“react-native/node_modules/@types/react”,就无法命名“Body”的推断类型。这可能不可移植。类型注释是必要的。

我尝试了几种方法,但错误仍然存​​在:

  1. 在这篇文章之后,我添加了import React from "react";
  2. 尝试通过在声明/* tslint:disable */上方添加来禁用 tslintBody
  3. 尝试通过在声明// tslint:disable-next-line上方添加来禁用 tslintBody
  4. 使用依赖版本。目前我有"@types/react": "^16.9.49" …

typescript tslint react-native styled-components prettier

5
推荐指数
2
解决办法
1万
查看次数

如何在 Puppeteer 中监听 postMessage 消息?

https://github.com/GoogleChrome/puppeteer/blob/master/examples/custom-event.js展示了如何定义自己的事件,但没有展示如何将事件数据传输回 Puppeteer 外部的代码。

例如,如果我想postMessage使用 Puppeteer 读取代码中页面的事件数据来启动页面,您会如何做?

相关: https: //github.com/GoogleChrome/puppeteer/issues/2366

events message google-chrome postmessage puppeteer

2
推荐指数
1
解决办法
3750
查看次数