This file contains hidden or 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
| !function(){"use strict";const e=()=>{const e=document.querySelector("#pxf-trade-auction-extranet").contentDocument,t=e.createElement("style");t.innerText=".el-table__header input, .el-table__body input { display: block; width: 50px; }",e.head.appendChild(t);const n=[...e.querySelectorAll(".el-form-item")][1].querySelector(".el-form-item__content"),r=e.querySelector(".el-table__header"),l=e.querySelector(".el-table__body"),c=[...r.querySelectorAll("tr")],a=[...l.querySelectorAll("tr")],o=e=>{const t=[...e.querySelectorAll("td")],n=t[2],r=t[3],l=t[7],c=t[4].querySelector("span span"),a=l.querySelector("span span"),o=n.querySelector("input"),i=r.querySelector("input"),u=Number(o.value),s=Number(c?.innerText),d=Number(i.value),p=u>Number(a?.innerText);a&&(a.style.background=p?"yellow":"unset");const m=""!==i.value&&d<s;c&&(c.style.background=m?"yellow":"unset")},i=()=>{a.forEach(o)};a.forEach((t=>{const n=[...t.querySelectorAll("td")][2],r=e.createElement("input");r.setAttribute("class","min-input"),r.addEventLi |
This file contains hidden or 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 handleSetup = () => { | |
| const iframe = document.querySelector('#pxf-trade-auction-extranet'); | |
| const iframeDocument = iframe.contentDocument; | |
| const d = iframeDocument; | |
| const styleElement = d.createElement('style'); | |
| styleElement.innerText = '.el-table__header input, .el-table__body input { display: block; width: 50px; }'; | |
| d.head.appendChild(styleElement); |
This file contains hidden or 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 func = () => { | |
| throw new Error('error') | |
| } | |
| const asyncFunc = async () => { | |
| throw new Error('async error') | |
| } | |
| const promiseFunc = () => { | |
| return Promise.reject(new Error('promise reject')) |
This file contains hidden or 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 natural from 'natural'; | |
| const tfidf = new natural.TfIdf(); | |
| const NGramsZH = natural.NGramsZH; | |
| const intention = { | |
| '新建分支': ['新建分支'], | |
| '查找代码库': ['代码库'], | |
| '搜索卡片': ['卡片'], | |
| '跳转流水线': ['跳转流水线'], |
This file contains hidden or 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 {useEffect} from 'react'; | |
| const createEventListenerHook = <K extends keyof DocumentEventMap>(type: K) => { | |
| type Listener = (e: DocumentEventMap[K]) => void; | |
| const listeners = new Set<Listener>(); | |
| const handleDocumentEvent = (e: DocumentEventMap[K]) => { | |
| listeners.forEach(listener => { | |
| listener(e); | |
| }); | |
| }; |
This file contains hidden or 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 browserslist from "browserslist"; | |
| import UAParser from "ua-parser-js"; | |
| import {mapValues, groupBy, uniq} from 'lodash'; | |
| const map = { | |
| "and_chr" : 'Chrome', | |
| "and_ff": 'Firefox', | |
| "and_qq": 'QQ', | |
| "and_uc": 'UCBrowser', | |
| "android": 'Android', |
This file contains hidden or 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 createCallback = <T>(obj: T) => { | |
| const setValue = <K extends keyof T>(key: K, value: T[K]) => { | |
| obj[key] = value; | |
| } | |
| return setValue | |
| } | |
| interface Obj { | |
| num: number; |
This file contains hidden or 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
| type Reducer<S, A> = (state: S, action: A) => S; | |
| type ReducerWithoutAction<S> = (state: S) => S; | |
| type Dispatch<T> = (value: T) => void; | |
| type DispatchWithoutAction = () => void; | |
| type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never; | |
| type ReducerAction<R extends Reducer<any, any>> = R extends Reducer<any, infer A> ? A : never; | |
| function useReducer<R extends ReducerWithoutAction<any>>(reducer: R): DispatchWithoutAction |
This file contains hidden or 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 Component = () => { | |
| const [count, increase] = useReducer(v => v + 1, 0); | |
| const handleClick = useCallback( | |
| () => { | |
| // TS2554: Expected 1 arguments, but got 0. | |
| increase(); | |
| }, | |
| [] | |
| ); | |
| return <>{count}<button onClick={handleClick}>Click Me</button></>; |