async & await
摘要:【await】 The await operator is used to wait for a Promise. It can only be used inside an async function. Returns the resolved value of the promise, or
阅读全文
Using Fetch
摘要:【Using Fetch】 This kind of functionality was previously achieved using XMLHttpRequest. Fetch provides a better alternative that can be easily used. 需要
阅读全文
Push API
摘要:【Push API】 The Push API gives web applications the ability to receive messages pushed to them from a server, whether or not the web app is in the fore
阅读全文
ServiceWorker.state
摘要:【ServiceWorker.state】 ServiceWorker.state The state read-only property of the ServiceWorker interface returns a string representing the current state
阅读全文
Using Service Workers
摘要:【Using Service Workers】 1、This is an experimental technology Because this technology's specification has not stabilized, check the compatibility table
阅读全文
Promise.then
摘要:【Promise.then】 1、If onFulfilled returns a promise, the return value of then will be resolved/rejected by the promise. 如果then的handler中返回一个promise(叫A),那
阅读全文
Promise()
摘要:【Promise()】 The constructor is primarily used to wrap functions that do not already support promises. executor A function that is passed with the argu
阅读全文
Using promises
摘要:【Using promises】 过去,异步方法这样写: function successCallback(result) { console.log("It succeeded with " + result); } function failureCallback(error) { consol
阅读全文
async.waterfall
摘要:【async.waterfall】 if any of the tasks pass an error to their own callback, the next function is not executed, and the main callback is immediately cal
阅读全文
async.series
摘要:【async.series】 series适用于顺序执行异步且前后无关联的调用。对于顺序执行异步且前后有叛逆的调用,则需要使用waterfall。 If any functions in the series pass an error to its callback, no more functi
阅读全文
prompt
摘要:【prompt】 prompt() 方法用于显示可提示用户进行输入的对话框。 如果用户单击提示框的取消按钮,则返回 null。如果用户单击确认按钮,则返回输入字段当前显示的文本。 在用户点击确定按钮或取消按钮把对话框关闭之前,它将阻止用户对浏览器的所有输入。在调用 prompt() 时,将暂停对 J
阅读全文
预览InputFile
摘要:【预览InputFile】 通过input的files属性,可以取到选择的File对象,通过FileReader可以将File对象读取出来。 参考:https://zhidao.baidu.com/question/872147854254047812.html
阅读全文
JavaScript Drag处理
摘要:【JavaScript Drag处理】 在拖动目标上触发事件 (源元素): ondragstart - 用户开始拖动元素时触发 ondrag - 元素正在拖动时触发 ondragend - 用户完成元素拖动后触发 释放目标时触发的事件: ondragenter - 当被鼠标拖动的对象进入其容器范围内
阅读全文
encodeURI & encodeURIComponent
摘要:【encodeURI & encodeURIComponent】 区别在于,"&", "+", 和 "=" 不会被encodeURI编码 参考: 1、https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Ob
阅读全文
javascript sourcemap
摘要:【javascript sourcemap】 暂时只有Chrome浏览器支持这个功能。在Developer Tools的Setting设置中,确认选中"Enable JavaScript source maps"。 setting->preference->source 只要在转换后的代码尾部,加上
阅读全文
ServiceWork的五种状态
摘要:【ServiceWork的五种状态】 installing、installed、activating、activated、redundant 参考:https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerState
阅读全文
onMouseOver&onMouseOut vs onMouseEnter&onMouseLeave
摘要:【onMouseOver&onMouseOut vs onMouseEnter&onMouseLeave】 1、onmouseleave、onmouseenter,鼠标进入到指定元素区域内触发事件,不支持冒泡,不包含子元素的区域。 2、onmouseout、onmouseover、鼠标进入指定元素触
阅读全文
ES2015 import & export
摘要:【ES2015 import】 The import statement is used to import functions, objects or primitives that have been exported from an external module, another scrip
阅读全文
Array.prototype.reduce
摘要:【Array.prototype.reduce】 Array.reduce([callback, initialValue]) 参数 参考:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects
阅读全文
Object.assign()
摘要:【getOwnPropertySymbols】 The Object.assign() method only copies enumerable and own properties from a source object to a target object. Note that Object
阅读全文