Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { computed, observable, action } from 'mobx'
- class Projects {
- @observable projects = []
- constructor (projects) {
- this.projects = projects
- }
- removeProject (projectId) {
- // this removes ALL projects
- this.projects = _.filter(this.projects, (project) => {
- !(project.id === projectId)
- })
- }
- removeProject (projectId) {
- // this removes 1 project
- this.projects = _.filter(this.projects, (project) => !(project.id === projectId))
- }
- }
- projects = new Projects([{id: '123', path: 'foo'}, {id: '456', path: 'bar'}])
- projects.removeProject('123')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement