2019.04.16

[新闻] Chrome 75 将默认启用延迟加载功能:https://addyosmani.com/blog/lazy-loading/

[视频] 基于 Umi 封装自己的框架:https://www.bilibili.com/video/av47877835

[类库] Ajx 是一个 JSON 数据格式校验库,实战案例https://github.com/pedronauck/docz/

[工具] Docz 用 MDX 写 React UI 组件文档,参考文章https://github.com/pedronauck/docz/

配图 - Docz

示例 - Ajx

const Ajv = require('ajv');
const ajv = new Ajv({allErrors: true});

const schema = {
  "properties": {
    "foo": { "type": "string" },
    "bar": { "type": "number", "maximum": 3 }
  }
};

const validate = ajv.compile(schema);

test({"foo": "abc", "bar": 2});
test({"foo": 2, "bar": 4});

function test(data) {
  var valid = validate(data);
  if (valid) console.log('Valid!');
  else console.log('Invalid: ' + ajv.errorsText(validate.errors));
}

今日配图