Skip to content

Instantly share code, notes, and snippets.

Avatar
🍺
Drunk

南小北 nanxiaobei

🍺
Drunk
View GitHub Profile
@tomhicks
tomhicks / plink-plonk.js
Last active Mar 20, 2021
Listen to your web pages
View plink-plonk.js
View TypeScript-JSDoc-Guides.md

Using JSDOC-Based TypeScript

Get Started

Choose your editor

  • WebStorm, Rider
    • Partial support, not enough intelli hints
    • Toggle on TypeScript language service
  • VSCode
@sstephenson
sstephenson / back_forward.js
Created Dec 13, 2010
How to detect whether a hash change came from the Back or Forward button
View back_forward.js
var detectBackOrForward = function(onBack, onForward) {
hashHistory = [window.location.hash];
historyLength = window.history.length;
return function() {
var hash = window.location.hash, length = window.history.length;
if (hashHistory.length && historyLength == length) {
if (hashHistory[hashHistory.length - 2] == hash) {
hashHistory = hashHistory.slice(0, -1);
onBack();