Assign Track Color by Frequencies
| Track | Color |
|---|---|
| Kick | #FF364D |
| Snare | #1AA1FF |
| Clap | #D68EA4 |
| Open HiHat | #03C539 |
| // Sample Usage | |
| <template> | |
| <button v-track="xxxEvent" /> | |
| <input v-track="xxxEvent" /> | |
| <input v-track="() => new Date().getTime()" /> | |
| </template> | |
| <script> | |
| // v-track directive | |
| Vue.directive("track", { |
| { | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "type": "node", | |
| "request": "launch", | |
| "name": "Run current script", | |
| "runtimeExecutable": "npx", | |
| "runtimeArgs": ["tsx"], | |
| "program": "${file}", |
| const PROXY_STATE = Symbol('immer-proxy-state') | |
| class State { | |
| srcObj | |
| copy | |
| touched | |
| parent | |
| constructor(srcObj, parent) { | |
| this.srcObj = srcObj |
| const optional = (srcObj) => { | |
| return new Proxy(() => {}, { | |
| apply: () => { | |
| return srcObj | |
| }, | |
| get: (__, prop) => { | |
| if (srcObj && srcObj.hasOwnProperty(prop)) { | |
| return optional(srcObj[prop]) | |
| } else { | |
| return optional(undefined) |
| import {ModalProvider, ModalContext, Modalman} from './Modalman' | |
| import {useContext} from 'react' | |
| import {Modal} from 'antd' | |
| // App.tsx | |
| // export default () => { | |
| // return <ModalProvider><App /><ModalProvider> | |
| // } | |
| export default () => { |
| (function() { | |
| /** | |
| * 记录方法使用情况的类 | |
| * @param {Array.<boolean>} umMap 初始的使用情况 | |
| */ | |
| var UsageManager = function(umMap) { | |
| this.umMap = umMap || []; | |
| }; | |
| /** | |
| * 记录新的使用情况 |
| interface Enum { | |
| [id: number]: string | |
| } | |
| const getEnumKeys = (e: Enum) => { | |
| return Object.keys(e) | |
| .map(key => e[key]) | |
| .filter(value => typeof value === 'string') as string[] | |
| } |
| import { __RouterContext as RouterContext, RouteComponentProps } from 'react-router' | |
| import { useContext, useMemo, useCallback } from 'react' | |
| import qs from 'qs' | |
| import { Location } from 'history' | |
| interface ParsedQuery { | |
| [whatever: string]: any | |
| } | |
| export const useRouter = <T>(): RouteComponentProps<T> => |