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
atom.packages.onDidActivateInitialPackages (initialPackages) -> | |
atom.commands.add 'atom-text-editor', 'akonwi:rename-file', (e) -> | |
atom.commands.dispatch e.target, 'tree-view:rename' | |
if gitPlus = atom.packages.getActivePackage('git-plus')?.mainModule.provideService() | |
gitPlus.registerCommand 'atom-text-editor', 'akonwi:update-last-commit', -> | |
gitPlus.getRepo() # If there are multiple repos in the project, you will be prompted to select which to use | |
.then (repo) -> gitPlus.run repo, 'commit --all --amend --no-edit' | |
gitPlus.registerCommand 'atom-text-editor', 'akonwi:unstage-last-commit', -> |
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 Listener<T> { | |
(value: T): void; | |
} | |
class Echo<T> implements Disposable { | |
private listeners = new Set<Listener<T>>(); | |
listen(listener: (value: T) => void) { | |
this.listeners.add(listener); | |
return new Disposable(() => { |
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 useDidChange(cb: (previous: any[]) => void, deps: any[]) { | |
const isMountedRef = React.useRef(false); | |
const cbRef = React.useRef(cb); | |
React.useEffect(() => { | |
cbRef.current = cb; | |
}, [cb]); | |
const previousRef = React.useRef(deps); | |
React.useEffect(() => { | |
if (isMountedRef.current) { |
OlderNewer