This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.clearfix:after{ | |
content: "."; | |
display: block; | |
height: 0; | |
clear: both; | |
visibility: hidden; | |
} | |
.clearfix{ | |
*zoom:1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//bind | |
function bind(fn, ctx) { | |
return function (a) { | |
var l = arguments.length; | |
return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx); | |
}; | |
} | |
//entend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isJS = function (file) { return /\.js(\?[^.]+)?$/.test(file); }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _toString = Object.prototype.toString; | |
/** | |
* Strict object type check. Only returns true | |
* for plain JavaScript objects. | |
*/ | |
function isPlainObject (obj) { | |
return _toString.call(obj) === '[object Object]' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* @Author: trigkit4 | |
* @Date: 2018-09-18 10:07:05 | |
*/ | |
import React, { Component, ComponentType } from 'react'; | |
import { computed, action, observable } from 'mobx'; | |
import { observer } from 'mobx-react'; | |
import _ from 'lodash'; | |
type BuildContainerOptions<T> = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SUBSTRING_TO_FIND = '-precache-'; | |
export default async function deleteWorkboxPreCaches( | |
filename: string, | |
substringToFind: string = SUBSTRING_TO_FIND, | |
) { | |
const cacheNames = await caches.keys(); | |
const cacheNamesToDelete = cacheNames.filter(cacheName => { | |
return cacheName.includes(substringToFind); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 数组去重对象 | |
var arr = [ | |
{ id: 1, city: "南京" }, | |
{ id: 2, city: "南京" }, | |
{ id: 3, city: "杭州" }, | |
{ id: 4, city: "广州" }, | |
]; | |
var newArr = arr.reduce((prev, cur) => { | |
obj[cur.city] ? "" : (obj[cur.city] = true && prev.push(cur)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useCallback, useEffect, useRef } from 'react' | |
function useIsMounted() { | |
const isMounted = useRef(false) | |
useEffect(() => { | |
isMounted.current = true | |
return () => { | |
isMounted.current = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useCallback, useState } from 'react' | |
export type MapOrEntries<K, V> = Map<K, V> | [K, V][] | |
// Public interface | |
export interface Actions<K, V> { | |
set: (key: K, value: V) => void | |
setAll: (entries: MapOrEntries<K, V>) => void | |
remove: (key: K) => void | |
reset: Map<K, V>['clear'] |
OlderNewer