随笔分类 -  javascript构件

javascript的一些特殊思路,凝结出来的智慧宝石!
摘要:1、下载安装nodejs, 2、npm安装模块 puppeteer-core, 3、然后运行当前js,参考demo输入url,就会下载所有的css、js、html等 下载nodejs,npm安装模块 puppeteer-core,然后运行当前js,参考demo输入url,就会下载所有的css、js、 阅读全文
posted @ 2019-07-25 16:07 无工时代 阅读(931) 评论(0) 推荐(0)
摘要:const puppeteer = require('puppeteer-core');const fs = require('fs');const path = require('path');const mkdir=require('./utils/mkdir');const Step=requ 阅读全文
posted @ 2019-07-18 19:26 无工时代 阅读(1226) 评论(0) 推荐(0)
摘要:const tinify = require("tinify"); tinify.key = "本人的appkey"; const fs=require('fs'); const glob=require('glob'); const mkdir=require('./utils/mkdir'); const srcDir='./src/'; //被搜索的资源 let sourceFile... 阅读全文
posted @ 2019-07-17 19:08 无工时代 阅读(691) 评论(0) 推荐(0)
摘要://app3.js//给less加上webkit前缀const glob=require('glob');const autoprefixer = require('autoprefixer')const postcss = require('postcss')const fs = require('fs')const syntax = require('postcss-less');const... 阅读全文
posted @ 2019-06-17 23:11 无工时代 阅读(490) 评论(0) 推荐(0)
摘要://mkdir.js const fs=require('fs'); const dirCache={}; function mkdir(filepath) { const arr=filepath.split('/'); let dir=arr[0]; for(let i=1;i<arr.length;i++){ if(!dirCache[dir]&&!... 阅读全文
posted @ 2019-06-14 17:03 无工时代 阅读(6311) 评论(1) 推荐(0)
摘要:为了性能优化,找出项目中没有用到的css、png、jpeg、jpg、js文件,对项目总体的资源有一个管理控制。 ### 技术栈 glob、ac多字符自动机、fs、path findNouseSource.js nouse.map 阅读全文
posted @ 2019-06-14 16:08 无工时代 阅读(329) 评论(0) 推荐(0)
摘要:TinyCss.js 阅读全文
posted @ 2019-06-10 18:14 无工时代 阅读(711) 评论(0) 推荐(0)
摘要://魔方旋转基础模型 class Point{ constructor(x,y,z){ this.mapData={ 0:[1,0], 45:[1,1], 90:[0,1], 135:[-1,1], 180:[-1,0], 225... 阅读全文
posted @ 2019-01-01 16:56 无工时代 阅读(239) 评论(1) 推荐(0)
摘要:用到的知识点: 1、bind函数 2、函数递归调用自身 3、promise test 阅读全文
posted @ 2018-11-16 16:12 无工时代 阅读(753) 评论(0) 推荐(0)
摘要:对函数参数的封装 一个原始函数有n个参数,用wrap对函数进行封装,生成一个新的函数,当给它传入参数数量为n的时候,将执行原始函数,否则不执行 阅读全文
posted @ 2018-11-13 10:50 无工时代 阅读(748) 评论(0) 推荐(0)
摘要:已知有流程step1、step2、step3、step4、step5 , 如何控制输出下面过程 例如: 1:step1、step2、step3、step2、step3、step4、step5 2:step1、step2、step4、step5 3:step1、step2、step4、step5、st 阅读全文
posted @ 2018-11-01 20:07 无工时代 阅读(203) 评论(0) 推荐(0)
摘要:/** * Check if two values are loosely equal - that is, * if they are plain objects, do they have the same shape? */ function looseEqual (a, b) { if (a === b) { return true } var isObjectA = is... 阅读全文
posted @ 2018-10-16 15:33 无工时代 阅读(1316) 评论(0) 推荐(0)
摘要:图片延迟加载组件 阅读全文
posted @ 2018-07-04 14:24 无工时代 阅读(232) 评论(0) 推荐(0)
摘要:解决性能问题 使用demo 源码 scroller.vue 阅读全文
posted @ 2018-07-04 14:22 无工时代 阅读(584) 评论(0) 推荐(0)
摘要://es6实现方式 const getData = async ()=> { //同步请求数据 const res1=await this.$http.get("https://www.cnblogs.com/yxy99/p/5852987.html") //并发请求数据 const res2=aw 阅读全文
posted @ 2018-05-09 15:51 无工时代 阅读(507) 评论(0) 推荐(0)
摘要:let obj={a:{c:21},b:2} const path='a.c' const val=hget(obj,path,'默认值') 没有值就返回默认值 //利用字符串路径获取对象集合的值 对象:result 路径:path 默认值:def function hget(result,path 阅读全文
posted @ 2018-03-16 16:54 无工时代 阅读(305) 评论(0) 推荐(0)
摘要:/* * config * caoke */ 'use strict'; //You can't use merge in util.js function merge(source, target){ if(typeof source === 'object' && typeof target === 'object'){ for(var key in targ... 阅读全文
posted @ 2017-01-10 15:29 无工时代 阅读(211) 评论(0) 推荐(0)
摘要:/* * config * caoke */ 'use strict'; Object.extend=function(props){ //继承父类 var prototype=Object.create(this.prototype) //初始化函数ctor var _Class=function(){ if(arguments.leng... 阅读全文
posted @ 2017-01-10 15:17 无工时代 阅读(189) 评论(0) 推荐(0)
摘要:var glob = require("glob") // options is optional var fs=require("fs") glob("**", function (er, files) { files.forEach(function(file){ var stat=fs.lstatSync(file) if(!stat.isDi... 阅读全文
posted @ 2016-11-16 19:58 无工时代 阅读(539) 评论(0) 推荐(0)
摘要:var config={ //不想访问的东西,节约流量 "404":[ "http://qidian.qpic.cn/qdbimg" ], //奇数为需要下载的,偶数为不需要下载的 needLoad:[ //匹配需要下载的 [ "/*.js", "/*.css"... 阅读全文
posted @ 2016-11-10 20:46 无工时代 阅读(441) 评论(0) 推荐(0)