摘要: electron 打包配置 配置参数见: https://www.cnblogs.com/mrwh/p/12961446.html { "name": "TestCustomWeb", "version": "1.0.0", "main": "index.js", "dependencies": { 阅读全文
posted @ 2020-08-31 19:34 Dai Hanlong 阅读(419) 评论(0) 推荐(0) 编辑
摘要: js中的二进制 ArrayBuffer Buffer TypedArray DataView Blob FileReader TextEncoder TextDecoder 浏览器环境下有的类: 除了 Buffer 浏览器下没有,其余都有 nodejs环境下有的类: Buffer ArrayBuff 阅读全文
posted @ 2020-08-29 00:04 Dai Hanlong 阅读(400) 评论(0) 推荐(0) 编辑
摘要: ```js let ele = document.getElementById('GameCanvas'); let rect = ele.getBoundingClientRect(); let touch = new Touch({ "identifier" : 0, "target" : ele, "clientX" : (rect.left + rect.right)/2, "client 阅读全文
posted @ 2020-02-23 02:24 Dai Hanlong 阅读(108) 评论(0) 推荐(0) 编辑
摘要: ``` js // 中文 转 unicode function chinese_to_unicode(ch,is16 = false) { let num_ten = ch.charCodeAt(ch); if(is16){ return '0x' + num_ten.toString(16); }else{ return num_ten.toString(); } } // unicode 转 阅读全文
posted @ 2019-10-21 16:20 Dai Hanlong 阅读(226) 评论(0) 推荐(0) 编辑
摘要: [TOC] 使用babel7 进行转码 需要提前安装的东西: 1. npx 方便执行命令 babel.config.js 配置 转换的命令 如: 将 js 目录下的文件 转换后 存放到 src目录下 更多内容查看babel官网 阅读全文
posted @ 2019-10-17 17:57 Dai Hanlong 阅读(184) 评论(0) 推荐(0) 编辑
摘要: [TOC] npx 的作用 http://www.ruanyifeng.com/blog/2019/02/npx.html 比较好用的js库 1. 解析大的json文件 big json 2. http/https 下载文件 request 3. 解析xml jxon 4. underscore 包 阅读全文
posted @ 2019-10-11 23:13 Dai Hanlong 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 1.数组解构 2.对象解构 3. 字符串的解构赋值 4. 数值和布尔值的解构赋值 解构赋值时,如果等号右边是数值和布尔值,则会先转为对象。 解构赋值的规则是,只要等号右边的值不是对象或数组,就先将其转为对象。 由于undefined和null无法转为对象,所以对它们进行解构赋值,都会报错。 5. 函 阅读全文
posted @ 2019-09-04 00:32 Dai Hanlong 阅读(187) 评论(0) 推荐(0) 编辑
摘要: [TOC] 关于取余运算 两个数 n d 进行取余,记为: n % d (d !== 0). 对于结果 r 的正负性,可以规定为,与 n 的符号一致. 见下面的mod函数. js console.log(' 12%5:', 12%5); console.log('12% 5:',12% 5); co 阅读全文
posted @ 2019-07-27 00:11 Dai Hanlong 阅读(1481) 评论(0) 推荐(0) 编辑
摘要: https://github.com/facebook/regenerator/blob/master/packages/regenerator runtime/runtime.js 1. 将此js文件导入为插件即可. 阅读全文
posted @ 2019-06-22 15:26 Dai Hanlong 阅读(858) 评论(0) 推荐(0) 编辑
摘要: [TOC] cc.Director cc.Director 继承自 EventTarget(前面分析过), 所以 cc.Director 也有 分发事件, 监听事件,发布事件的能力. 其包含的几个关键属性: 解释一下里面几个东西的作用. a. this._scheduler 一个全局的调度器. _a 阅读全文
posted @ 2019-02-28 17:26 Dai Hanlong 阅读(813) 评论(0) 推荐(0) 编辑