Created
September 18, 2019 10:32
-
-
Save vitch/d8edb1b5d4895daf944cf5f086454d28 to your computer and use it in GitHub Desktop.
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 Tab from "./tab"; | |
import { filter } from "microstates"; | |
export default class TabManager { | |
tabs = [Tab]; | |
get openTabs() { | |
return filter(this.tabs, tab => tab.isOpen.state); | |
} | |
activateTab(tab) { | |
console.log(this, "activateTab", tab); | |
return tab.isOpen.set(true); | |
} | |
} |
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
export default class Tab { | |
id = Number; | |
label = String; | |
isOpen = Boolean; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment