随笔分类 -  js

摘要:希望能摆脱lodash的深拷贝 🐻 阅读全文
posted @ 2018-06-02 00:58 Ajanuw 阅读(587) 评论(0) 推荐(0)
摘要:调试 阅读全文
posted @ 2018-06-01 22:19 Ajanuw 阅读(625) 评论(0) 推荐(0)
摘要:// 创建xml数据 let doc = document.implementation.createDocument('', 'root', null); // 创建一个文档 let root =doc.documentElement; // 获取文档 let user = doc.createE 阅读全文
posted @ 2018-05-30 21:37 Ajanuw 阅读(68) 评论(0) 推荐(0)
摘要:"MDN" 监听css动画,开始,迭代次数,结束,中断 回调函数返回 animationEvent属性 html <!DOCTYPE html .a { width: 100px; height: 100px; background: red; animation: test 2.5s cubic 阅读全文
posted @ 2018-01-08 21:53 Ajanuw 阅读(1294) 评论(0) 推荐(0)
摘要:/** * * 根据秒数返回 一个日期范围 * timerFilter(10) */ function timerFilter(n) { let days = 31; // 一月多少天 const oneM = 60; // 一分钟s const halfAnHour = oneM * 30; // 阅读全文
posted @ 2017-12-31 22:59 Ajanuw 阅读(476) 评论(0) 推荐(0)
摘要:MDN文档 MSDN文档 该对象下有 5个方法 Collator:ƒ Collator() DateTimeFormat:ƒ DateTimeFormat() NumberFormat:ƒ NumberFormat() getCanonicalLocales:ƒ getCanonicalLocale 阅读全文
posted @ 2017-12-27 17:22 Ajanuw
摘要:MDN文档 拦截 // index.html var obj = { name:'ajanuw' } var handle = { // 通过代理可以 约束,验证 向一个对象传的 key:value get(target, key){ return Reflect.has(target, key) 阅读全文
posted @ 2017-12-26 22:12 Ajanuw
摘要:MDN文档 Reflect 是一个内置的对象,它提供拦截 JavaScript 操作的方法。不可构造(not new)。 Reflect.apply // Reflect.apply(target, thisArgument, argumentsList) target, 目标函数。 thisArg 阅读全文
posted @ 2017-12-26 12:00 Ajanuw
摘要:类似nodejs的 child_process.fork() 动态创建server.js文件 js const workerJSString = ` // 接收主线程发来的的数据 onmessage = ({data})= { // 向主线程发送data console.log(\ ); postM 阅读全文
posted @ 2017-12-25 13:06 Ajanuw 阅读(978) 评论(0) 推荐(0)
摘要:返回调用指定函数的函数. javascript function test() { if (test.caller === null) console.log('test 函数在全局调用'); // 获取调用 test函数, 的函数名 console.log(test.caller.name ); 阅读全文
posted @ 2017-12-22 10:43 Ajanuw 阅读(152) 评论(0) 推荐(0)
摘要:MDN 文档 首先你需要让用户上传图片 <input type="file" accept="image/*" id="upfile" /> 默认会让用户在 相册 或则 摄像头 中选择,如果加上 capture="camera" 则默认打开摄像头 当上传图片时,先在本地预览图片 document.q 阅读全文
posted @ 2017-12-20 19:51 Ajanuw 阅读(133) 评论(0) 推荐(0)
摘要:```html ``` 阅读全文
posted @ 2017-12-08 16:08 Ajanuw 阅读(377) 评论(0) 推荐(0)
摘要:"MDN上说的很清楚" MutationObserver给开发者们提供了一种能在某个范围内的DOM树发生变化时作出适当反应的能力.该API设计用来替换掉在DOM3事件规范中引入的Mutation事件 config 阅读全文
posted @ 2017-12-07 11:46 Ajanuw 阅读(1558) 评论(0) 推荐(0)
摘要:## js正则表达式 ```javascript 'ajanuw'.replace(/a/g, 'x'); //"xjxnuw" 'ajanuw'.replace(new RegExp('a', 'g'), 'x'); //"xjxnuw" ``` ## 修饰符 flags ``` g 全局匹配, 阅读全文
posted @ 2017-12-06 23:35 Ajanuw
摘要:` 阅读全文
posted @ 2017-12-05 14:33 Ajanuw 阅读(149) 评论(0) 推荐(0)
摘要:var {log} = console // Document.characterSet 返回文档使用的字符集。 log(`1 ${document.characterSet} \n\n`) // Document.compatMode Quirks 模式还是在 Strict 模式下渲染文档的 <! 阅读全文
posted @ 2017-11-28 15:02 Ajanuw