public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory t ...
分类:
编程语言 时间:
2018-07-20 01:12:48
阅读次数:
190
'use strict';const Service = require('egg').Service;const fs = require('fs');const path = require('path');const sendToWormhole = require('stream-wormh ...
分类:
其他好文 时间:
2018-07-19 00:11:39
阅读次数:
794
class Person { async getVersion () { return new Promise((resolve, reject) => { setTimeout(function () { resolve('1.0'); // reject('fail') }, 1000); ..... ...
分类:
其他好文 时间:
2018-07-16 11:27:32
阅读次数:
143
ES6中Promise可以说很大情况下改善了异步回调的嵌套问题,那么如果我们自己去写一个类似Promise的库应该怎么去写? 我们先看一下Promise的特点: 第一:Promise构造函数接受一个函数作为参数,函数里面有两个参数resolve和reject分别作为执行成功或者执行失败的函数 第二: ...
分类:
Web程序 时间:
2018-07-11 23:53:50
阅读次数:
792
let isNum = num => { new Promise((resolve,reject)=>{ if(typeof num 'number'){ resolve() }else{ reject() } }).then(()=>{ console.log(`${num}是数字`) }).ca ...
分类:
其他好文 时间:
2018-07-08 23:08:19
阅读次数:
190
主要借助百度搜索的API,调用时会存在跨域问题,需要通过JSONP来解决这个问题,代码如下(代码中部分使用ES6语法): HTML js: ...
分类:
Web程序 时间:
2018-07-05 18:28:50
阅读次数:
204
const getJSON = function(url,type,data) { const promise = new Promise(function(resolve, reject){ const handler = function() { if (this.readyState !== ...
分类:
其他好文 时间:
2018-07-03 14:37:02
阅读次数:
173
1.新建文件夹 util , 在util里边新建 mm.jsx文件 2.使用jquery里边的ajax发送请求,回调用promise,返回一个promise对象 request(param){ return new Promise((resolve, reject) => { $.ajax({ ty... ...
分类:
Web程序 时间:
2018-06-26 16:04:57
阅读次数:
627
iptables 即 Linux防火墙 的简单介绍及使用 iptables生效位置如下图: 其中, 网络防火墙也可以使用一台启用了iptables的Linux主机代替; 路由器或集线器等设施在拓扑中省略了; 那么上图显示出了iptables在哪里, 下面说一下iptables的工作原理: 我们知道L ...
分类:
系统相关 时间:
2018-06-24 17:03:46
阅读次数:
325
做项目做烦了就想找点乐子。 比如,我们可以自定义脚手架提示。 webpack.dev.conf.js 54-78 行 最后效果是这样的: ...
分类:
其他好文 时间:
2018-06-19 22:38:41
阅读次数:
168