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 baiduMap = { | |
show() { | |
console.log('开始渲染百度地图。') | |
} | |
} | |
const renderMap = (map) => { | |
map.show() | |
} |
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
class Computer { | |
constructor(mouse: string, keyboard: string, monitor: string) {} | |
} | |
class ComputerBuilder { | |
mouse: string; | |
keyboard: string; | |
monitor: string; | |
addMouse(mouse: string) { |
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
interface Computer { | |
run: () => void; | |
} | |
class Windows implements Computer { | |
run() { | |
console.log('Windows') | |
} | |
} |
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
function debounce(func, wait = 200, immediate) { | |
let timeout = null; | |
let context = null; | |
let args = null; | |
let previous = null; | |
let result = null; | |
function later() { | |
var passed = Date.now() - previous; | |
if (passed < wait) { |
NewerOlder