随笔分类 - JavaScript
摘要:Electron http://www.loongnix.cn/zh/api/electron/ 或者 http://ftp.loongnix.cn/electron/LoongArch/
阅读全文
摘要:主Js文件内容: //注意: //使用前先判断浏览器是否支持 //Worker内的代码不可以操作DOM //不能跨域加载Worker的js文件 if(window.Worker !== undefined) { //新建Worker,类似创建子线程 let worker = new Worker('
阅读全文
摘要:let arr1 = [1,2,3,4,5]; let arr2 = [4,5,6,7,8]; //数组求交集 function arrayIntersection(arr1,arr2) { //先去重 let arr1Unique = [...new Set(arr1)]; //去重转为set l
阅读全文
摘要:let arr1 = [1,2,3,4,5]; let arr2 = [4,5,6,7,8]; //数组求差集 function arrayDiff(arr1,arr2) { //先去重 let arr1Unique = [...new Set(arr1)]; let arr2UniqueSet =
阅读全文
摘要:Promise.allSettled 执行多个Promise对象实例,配合await使用,可以达到等待任务全部完成后再继续执行的效果。 返回值是一个成功的Promise,其内部值为参数中的Promise的执行结果组成的数组。 const pandaTest1 = new Promise((resol
阅读全文
摘要:async function async function 说明 和C#中的使用类似。不过Task在Javascript中使用的是Promise对象。 async function 的返回值 async function testAsyncFunction() { // 返回字符串 // 函数返回一
阅读全文
摘要:NodeJS项目安装包 npm install babel-plugin-transform-remove-console --save-dev 配置Babel const plugins = [] //如果不是开发环境则启用 if (process.env.NODE_ENV !== 'develo
阅读全文
摘要:let arr1 = [1,2,3,4,5]; let arr2 = [4,5,6,7,8]; //数组求并集 function arrayUnion(arr1,arr2) { return [...new Set([...arr1,...arr2])]; } console.log(arrayUn
阅读全文
摘要:NodeJS安装必要的工具包 # 初始化项目 npm init -yes ## 安装babel browserify等包 npm i babel-cli babel-preset-env browserify -D 使用 ## babel转换指定文件夹下的代码 npx babel "/src/js"
阅读全文
摘要:常见回调函数: DOM事件回调函数 Ajax回调函数 生命周期回调函数 定时器回调函数
阅读全文
摘要:更新记录 点击查看 2024年3月6日 添加多种方法。 2023年2月2日 初始化。 使用集合的方式 let arr = [5,4,0,8,8,8,8,5,4,0]; let result = [...new Set(arr)]; console.log(result); 使用filter func
阅读全文
摘要:更新记录 点击查看 ``` >2023年3月1日 优化内容结构,加入组件中查询内容 >2023年1月6日 更新Ext.getCmp >2022年12月3日 开始。 ``` ExtJS教程汇总:https://www.cnblogs.com/cqpanda/p/16328016.html 查询组件 E
阅读全文
摘要:更新记录 2023年1月6日 从笔记迁移到博客。 转载请注明出处: ExtJS教程汇总:https://www.cnblogs.com/cqpanda/p/16328016.html 使用 Ext.util.Observable 类型即可。 代码实例: //定义类型 Ext.define('Myap
阅读全文
摘要:const getSelectedText = () => window.getSelection().toString(); getSelectedText(); JQuery实例: $(function(){ const getSelectedText = () => window.getSel
阅读全文
摘要:const goToTop = () => window.scrollTo(0, 0); goToTop();
阅读全文
摘要:const randomstr = Math.random().toString(36).substring(7);
阅读全文
摘要:用于判断页面是否在底部 const scrolledToBottom = () => document.documentElement.clientHeight + window.scrollY >= document.documentElement.scrollHeight; scrolledTo
阅读全文
摘要:const isTabInView = () => !document.hidden; console.log(isTabInView());
阅读全文
摘要:const showPrintDialog = () => window.print()
阅读全文
摘要:用于重定向到新 URL const redirect = url => location.href = url redirect("https://www.google.com/");
阅读全文

浙公网安备 33010602011771号