[前端] 每日时报-2019.06.13

2019-06-12 17:37:30 +08:00
 wubaiqing

[前端] 每日时报-2019.06.13

https://github.com/wubaiqing/zaobao

[新闻] VueConf 2019 尤雨溪演讲总结:https://mp.weixin.qq.com/s/6N6tuUEmS7eUOg82XQw8EA

[类库] RxDB 是一个 JavaScript 客户端数据库,主要用于浏览器、NodeJS、Electron、Cordova、React-Native 以及其他任何 JavaScript 运行环境:https://github.com/pubkey/rxdb

[类库] 有时我们需要在浏览器上生成文件并保存到本地,这个借助 FileSaver.js 就可以很方便地实现。FileSaver.js 是一款基于 HTML5 完成文件保存插件,它可以帮你直接从网页中导出多种格式文件:https://github.com/eligrey/FileSaver.js

[类库] resolve-bin 是通过检查 node_modules 各个包中的 package.json bin 字段,来解析指定包的 bin 文件目录 :https://github.com/thlorenz/resolve-bin

示例 - RxDB

import RxDB from 'rxdb';
const db = await RxDB.create({
    name: 'heroesdb',
    adapter: 'websql',
    password: 'myLongAndStupidPassword', // optional
    multiInstance: true                  // default: true
  });                                                       // create database

await db.collection({name: 'heroes', schema: mySchema});    // create collection
db.heroes.insert({ name: 'Bob' });                          // insert document

示例 - FileSaver.js

var FileSaver = require('file-saver');
var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
FileSaver.saveAs(blob, "hello world.txt");

示例 - resolve-bin

var resolveBin = require('resolve-bin');

// package.json: "bin": "bin/tap.js"
resolveBin('tap', function (err, bin) {
  if (err) return console.error(err);
  console.log(bin);  
});

// => [..]/resolve-bin/node_modules/tap/bin/tap.js

配图 - VueConf 2019 尤雨溪演讲总结

今日图 - 工作的我 VS 下班的我

查看更多: https://wubaiqing.github.io/zaobao/2019/06/12.html

970 次点击
所在节点    分享发现
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/573283

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX