type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
ArrowFunction |
() => {
TestBed.configureTestingModule({
declarations: [RootCmp, TodoComponent],
imports: [
StoreModule.forRoot({ todos: todosReducer, user: userReducer }),
StoreRouterConnectingModule,
RouterTestingModule.withRoutes([
{ path: 'todo/:id', component: TodoComponent }
]),
NxModule.forRoot()
]
});
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.navigation(TodoComponent, {
run: (a, state) => {
return {
type: 'TODO_LOADED',
payload: { id: a.params['id'], user: state.user }
};
},
onError: () => null
});
constructor(private s: DataPersistence<TodosState>) {}
}
beforeEach(() => {
TestBed.configureTestingModule({
imports: [EffectsModule.forRoot([TodoEffects])]
});
});
it('should work', fakeAsync(() => {
const root = TestBed.createComponent(RootCmp);
const router: Router = TestBed.get(Router);
router.navigateByUrl('/todo/123');
tick(0);
root.detectChanges(false);
expect(root.elementRef.nativeElement.innerHTML).toContain('ID 123');
expect(root.elementRef.nativeElement.innerHTML).toContain('User bob');
}));
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, state) => {
return {
type: 'TODO_LOADED',
payload: { id: a.params['id'], user: state.user }
};
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
TestBed.configureTestingModule({
imports: [EffectsModule.forRoot([TodoEffects])]
});
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
const root = TestBed.createComponent(RootCmp);
const router: Router = TestBed.get(Router);
router.navigateByUrl('/todo/123');
tick(0);
root.detectChanges(false);
expect(root.elementRef.nativeElement.innerHTML).toContain('ID 123');
expect(root.elementRef.nativeElement.innerHTML).toContain('User bob');
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.navigation(TodoComponent, {
run: (a, state) => {
if (a.params['id'] === '123') {
throw new Error('boom');
} else {
return {
type: 'TODO_LOADED',
payload: { id: a.params['id'], user: state.user }
};
}
},
onError: (a, e) => ({ type: 'ERROR', payload: { error: e } })
});
constructor(private s: DataPersistence<TodosState>) {}
}
beforeEach(() => {
TestBed.configureTestingModule({
imports: [EffectsModule.forRoot([TodoEffects])]
});
});
it('should work', fakeAsync(() => {
const root = TestBed.createComponent(RootCmp);
const router: Router = TestBed.get(Router);
let actions: any[] = [];
TestBed.get(Actions).subscribe((a: any) => actions.push(a));
router.navigateByUrl('/todo/123');
tick(0);
root.detectChanges(false);
expect(root.elementRef.nativeElement.innerHTML).not.toContain('ID 123');
expect(actions.map(a => a.type)).toContain('ERROR');
expect(
actions.find(a => a.type === 'ERROR').payload.error.message
).toEqual('boom');
// can recover after an error
router.navigateByUrl('/todo/456');
tick(0);
root.detectChanges(false);
expect(root.elementRef.nativeElement.innerHTML).toContain('ID 456');
}));
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, state) => {
if (a.params['id'] === '123') {
throw new Error('boom');
} else {
return {
type: 'TODO_LOADED',
payload: { id: a.params['id'], user: state.user }
};
}
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, e) => ({ type: 'ERROR', payload: { error: e } }) | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
const root = TestBed.createComponent(RootCmp);
const router: Router = TestBed.get(Router);
let actions: any[] = [];
TestBed.get(Actions).subscribe((a: any) => actions.push(a));
router.navigateByUrl('/todo/123');
tick(0);
root.detectChanges(false);
expect(root.elementRef.nativeElement.innerHTML).not.toContain('ID 123');
expect(actions.map(a => a.type)).toContain('ERROR');
expect(
actions.find(a => a.type === 'ERROR').payload.error.message
).toEqual('boom');
// can recover after an error
router.navigateByUrl('/todo/456');
tick(0);
root.detectChanges(false);
expect(root.elementRef.nativeElement.innerHTML).toContain('ID 456');
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a: any) => actions.push(a) | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
a => a.type | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
a => a.type === 'ERROR' | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.navigation(TodoComponent, {
run: (a, state) => {
if (a.params['id'] === '123') {
return throwError('boom');
} else {
return {
type: 'TODO_LOADED',
payload: { id: a.params['id'], user: state.user }
};
}
},
onError: (a, e) => ({ type: 'ERROR', payload: { error: e } })
});
constructor(private s: DataPersistence<TodosState>) {}
}
beforeEach(() => {
TestBed.configureTestingModule({
imports: [EffectsModule.forRoot([TodoEffects])]
});
});
it('should work', fakeAsync(() => {
const root = TestBed.createComponent(RootCmp);
const router: Router = TestBed.get(Router);
let actions: any[] = [];
TestBed.get(Actions).subscribe((a: any) => actions.push(a));
router.navigateByUrl('/todo/123');
tick(0);
root.detectChanges(false);
expect(root.elementRef.nativeElement.innerHTML).not.toContain('ID 123');
expect(actions.map(a => a.type)).toContain('ERROR');
expect(actions.find(a => a.type === 'ERROR').payload.error).toEqual(
'boom'
);
router.navigateByUrl('/todo/456');
tick(0);
root.detectChanges(false);
expect(root.elementRef.nativeElement.innerHTML).toContain('ID 456');
}));
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, state) => {
if (a.params['id'] === '123') {
return throwError('boom');
} else {
return {
type: 'TODO_LOADED',
payload: { id: a.params['id'], user: state.user }
};
}
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
const root = TestBed.createComponent(RootCmp);
const router: Router = TestBed.get(Router);
let actions: any[] = [];
TestBed.get(Actions).subscribe((a: any) => actions.push(a));
router.navigateByUrl('/todo/123');
tick(0);
root.detectChanges(false);
expect(root.elementRef.nativeElement.innerHTML).not.toContain('ID 123');
expect(actions.map(a => a.type)).toContain('ERROR');
expect(actions.find(a => a.type === 'ERROR').payload.error).toEqual(
'boom'
);
router.navigateByUrl('/todo/456');
tick(0);
root.detectChanges(false);
expect(root.elementRef.nativeElement.innerHTML).toContain('ID 456');
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
beforeEach(() => {
TestBed.configureTestingModule({ providers: [DataPersistence] });
});
describe('no id', () => {
type GetTodos = {
type: 'GET_TODOS';
};
type GetTodo = {
type: 'GET_TODO';
};
@Injectable()
class TodoEffects {
@Effect()
loadTodos = this.s.fetch<GetTodos>('GET_TODOS', {
run: (a, state) => {
// we need to introduce the delay to "enable" switchMap
return of({
type: 'TODOS',
payload: { user: state.user, todos: 'some todos' }
}).pipe(delay(1));
},
onError: (a, e: any) => null
});
@Effect()
loadTodosWithOperator = this.s.actions.pipe(
ofType<GetTodos>('GET_TODOS'),
withLatestFrom(this.s.store),
fetch({
run: (action, state) => {
return of({
type: 'TODOS',
payload: { user: state.user, todos: 'some todos' }
}).pipe(delay(1));
}
})
);
constructor(private s: DataPersistence<TodosState>) {}
}
function userReducer() {
return 'bob';
}
let actions: Observable<any>;
beforeEach(() => {
actions = new Subject<any>();
TestBed.configureTestingModule({
providers: [TodoEffects, provideMockActions(() => actions)],
imports: [StoreModule.forRoot({ user: userReducer })]
});
});
it('should work', async done => {
actions = of(
{ type: 'GET_TODOS', payload: {} },
{ type: 'GET_TODOS', payload: {} }
);
expect(await readAll(TestBed.get(TodoEffects).loadTodos)).toEqual([
{ type: 'TODOS', payload: { user: 'bob', todos: 'some todos' } },
{ type: 'TODOS', payload: { user: 'bob', todos: 'some todos' } }
]);
done();
});
it('should work with an operator', async done => {
actions = of(
{ type: 'GET_TODOS', payload: {} },
{ type: 'GET_TODOS', payload: {} }
);
expect(
await readAll(TestBed.get(TodoEffects).loadTodosWithOperator)
).toEqual([
{ type: 'TODOS', payload: { user: 'bob', todos: 'some todos' } },
{ type: 'TODOS', payload: { user: 'bob', todos: 'some todos' } }
]);
done();
});
});
describe('id', () => {
type GetTodo = {
type: 'GET_TODO';
payload: { id: string };
};
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.fetch<GetTodo>('GET_TODO', {
id: (a, state) => a.payload.id,
run: (a, state) =>
of({ type: 'TODO', payload: a.payload }).pipe(delay(1)),
onError: (a, e: any) => null
});
constructor(private s: DataPersistence<TodosState>) {}
}
function userReducer() {
return 'bob';
}
let actions: Observable<any>;
beforeEach(() => {
actions = new Subject<any>();
TestBed.configureTestingModule({
providers: [TodoEffects, provideMockActions(() => actions)],
imports: [StoreModule.forRoot({ user: userReducer })]
});
});
it('should work', async done => {
actions = of(
{ type: 'GET_TODO', payload: { id: 1, value: '1' } },
{ type: 'GET_TODO', payload: { id: 2, value: '2a' } },
{ type: 'GET_TODO', payload: { id: 2, value: '2b' } }
);
expect(await readAll(TestBed.get(TodoEffects).loadTodo)).toEqual([
{ type: 'TODO', payload: { id: 1, value: '1' } },
{ type: 'TODO', payload: { id: 2, value: '2b' } }
]);
done();
});
});
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
TestBed.configureTestingModule({ providers: [DataPersistence] });
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
type GetTodos = {
type: 'GET_TODOS';
};
type GetTodo = {
type: 'GET_TODO';
};
@Injectable()
class TodoEffects {
@Effect()
loadTodos = this.s.fetch<GetTodos>('GET_TODOS', {
run: (a, state) => {
// we need to introduce the delay to "enable" switchMap
return of({
type: 'TODOS',
payload: { user: state.user, todos: 'some todos' }
}).pipe(delay(1));
},
onError: (a, e: any) => null
});
@Effect()
loadTodosWithOperator = this.s.actions.pipe(
ofType<GetTodos>('GET_TODOS'),
withLatestFrom(this.s.store),
fetch({
run: (action, state) => {
return of({
type: 'TODOS',
payload: { user: state.user, todos: 'some todos' }
}).pipe(delay(1));
}
})
);
constructor(private s: DataPersistence<TodosState>) {}
}
function userReducer() {
return 'bob';
}
let actions: Observable<any>;
beforeEach(() => {
actions = new Subject<any>();
TestBed.configureTestingModule({
providers: [TodoEffects, provideMockActions(() => actions)],
imports: [StoreModule.forRoot({ user: userReducer })]
});
});
it('should work', async done => {
actions = of(
{ type: 'GET_TODOS', payload: {} },
{ type: 'GET_TODOS', payload: {} }
);
expect(await readAll(TestBed.get(TodoEffects).loadTodos)).toEqual([
{ type: 'TODOS', payload: { user: 'bob', todos: 'some todos' } },
{ type: 'TODOS', payload: { user: 'bob', todos: 'some todos' } }
]);
done();
});
it('should work with an operator', async done => {
actions = of(
{ type: 'GET_TODOS', payload: {} },
{ type: 'GET_TODOS', payload: {} }
);
expect(
await readAll(TestBed.get(TodoEffects).loadTodosWithOperator)
).toEqual([
{ type: 'TODOS', payload: { user: 'bob', todos: 'some todos' } },
{ type: 'TODOS', payload: { user: 'bob', todos: 'some todos' } }
]);
done();
});
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, state) => {
// we need to introduce the delay to "enable" switchMap
return of({
type: 'TODOS',
payload: { user: state.user, todos: 'some todos' }
}).pipe(delay(1));
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, e: any) => null | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(action, state) => {
return of({
type: 'TODOS',
payload: { user: state.user, todos: 'some todos' }
}).pipe(delay(1));
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
actions = new Subject<any>();
TestBed.configureTestingModule({
providers: [TodoEffects, provideMockActions(() => actions)],
imports: [StoreModule.forRoot({ user: userReducer })]
});
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
async done => {
actions = of(
{ type: 'GET_TODOS', payload: {} },
{ type: 'GET_TODOS', payload: {} }
);
expect(await readAll(TestBed.get(TodoEffects).loadTodos)).toEqual([
{ type: 'TODOS', payload: { user: 'bob', todos: 'some todos' } },
{ type: 'TODOS', payload: { user: 'bob', todos: 'some todos' } }
]);
done();
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
async done => {
actions = of(
{ type: 'GET_TODOS', payload: {} },
{ type: 'GET_TODOS', payload: {} }
);
expect(
await readAll(TestBed.get(TodoEffects).loadTodosWithOperator)
).toEqual([
{ type: 'TODOS', payload: { user: 'bob', todos: 'some todos' } },
{ type: 'TODOS', payload: { user: 'bob', todos: 'some todos' } }
]);
done();
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
type GetTodo = {
type: 'GET_TODO';
payload: { id: string };
};
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.fetch<GetTodo>('GET_TODO', {
id: (a, state) => a.payload.id,
run: (a, state) =>
of({ type: 'TODO', payload: a.payload }).pipe(delay(1)),
onError: (a, e: any) => null
});
constructor(private s: DataPersistence<TodosState>) {}
}
function userReducer() {
return 'bob';
}
let actions: Observable<any>;
beforeEach(() => {
actions = new Subject<any>();
TestBed.configureTestingModule({
providers: [TodoEffects, provideMockActions(() => actions)],
imports: [StoreModule.forRoot({ user: userReducer })]
});
});
it('should work', async done => {
actions = of(
{ type: 'GET_TODO', payload: { id: 1, value: '1' } },
{ type: 'GET_TODO', payload: { id: 2, value: '2a' } },
{ type: 'GET_TODO', payload: { id: 2, value: '2b' } }
);
expect(await readAll(TestBed.get(TodoEffects).loadTodo)).toEqual([
{ type: 'TODO', payload: { id: 1, value: '1' } },
{ type: 'TODO', payload: { id: 2, value: '2b' } }
]);
done();
});
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, state) => a.payload.id | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, state) =>
of({ type: 'TODO', payload: a.payload }).pipe(delay(1)) | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
async done => {
actions = of(
{ type: 'GET_TODO', payload: { id: 1, value: '1' } },
{ type: 'GET_TODO', payload: { id: 2, value: '2a' } },
{ type: 'GET_TODO', payload: { id: 2, value: '2b' } }
);
expect(await readAll(TestBed.get(TodoEffects).loadTodo)).toEqual([
{ type: 'TODO', payload: { id: 1, value: '1' } },
{ type: 'TODO', payload: { id: 2, value: '2b' } }
]);
done();
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
beforeEach(() => {
TestBed.configureTestingModule({ providers: [DataPersistence] });
});
describe('successful', () => {
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.pessimisticUpdate<UpdateTodo>('UPDATE_TODO', {
run: (a, state) => ({
type: 'TODO_UPDATED',
payload: { user: state.user, newTitle: a.payload.newTitle }
}),
onError: (a, e: any) => null
});
@Effect()
loadTodoWithOperator = this.s.actions.pipe(
ofType<UpdateTodo>('UPDATE_TODO'),
withLatestFrom(this.s.store),
pessimisticUpdate({
run: (a, state) => ({
type: 'TODO_UPDATED',
payload: { user: state.user, newTitle: a.payload.newTitle }
}),
onError: (a, e: any) => null
})
);
constructor(private s: DataPersistence<TodosState>) {}
}
function userReducer() {
return 'bob';
}
let actions: Observable<any>;
beforeEach(() => {
actions = new Subject<any>();
TestBed.configureTestingModule({
providers: [TodoEffects, provideMockActions(() => actions)],
imports: [StoreModule.forRoot({ user: userReducer })]
});
});
it('should work', async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
expect(await readAll(TestBed.get(TodoEffects).loadTodo)).toEqual([
{
type: 'TODO_UPDATED',
payload: { user: 'bob', newTitle: 'newTitle' }
}
]);
done();
});
it('should work with an operator', async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
expect(
await readAll(TestBed.get(TodoEffects).loadTodoWithOperator)
).toEqual([
{
type: 'TODO_UPDATED',
payload: { user: 'bob', newTitle: 'newTitle' }
}
]);
done();
});
});
describe('`run` throws an error', () => {
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.pessimisticUpdate<UpdateTodo>('UPDATE_TODO', {
run: (a, state) => {
throw new Error('boom');
},
onError: (a, e: any) => ({
type: 'ERROR',
payload: { error: e }
})
});
constructor(private s: DataPersistence<TodosState>) {}
}
function userReducer() {
return 'bob';
}
let actions: Observable<any>;
beforeEach(() => {
actions = new Subject<any>();
TestBed.configureTestingModule({
providers: [TodoEffects, provideMockActions(() => actions)],
imports: [StoreModule.forRoot({ user: userReducer })]
});
});
it('should work', async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
const [a]: any = await readAll(TestBed.get(TodoEffects).loadTodo);
expect(a.type).toEqual('ERROR');
expect(a.payload.error.message).toEqual('boom');
done();
});
});
describe('`run` returns an observable that errors', () => {
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.pessimisticUpdate<UpdateTodo>('UPDATE_TODO', {
run: (a, state) => {
return throwError('boom');
},
onError: (a, e: any) => ({
type: 'ERROR',
payload: { error: e }
})
});
constructor(private s: DataPersistence<TodosState>) {}
}
function userReducer() {
return 'bob';
}
let actions: Observable<any>;
beforeEach(() => {
actions = new Subject<any>();
TestBed.configureTestingModule({
providers: [TodoEffects, provideMockActions(() => actions)],
imports: [StoreModule.forRoot({ user: userReducer })]
});
});
it('should work', async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
const [a]: any = await readAll(TestBed.get(TodoEffects).loadTodo);
expect(a.type).toEqual('ERROR');
expect(a.payload.error).toEqual('boom');
done();
});
});
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.pessimisticUpdate<UpdateTodo>('UPDATE_TODO', {
run: (a, state) => ({
type: 'TODO_UPDATED',
payload: { user: state.user, newTitle: a.payload.newTitle }
}),
onError: (a, e: any) => null
});
@Effect()
loadTodoWithOperator = this.s.actions.pipe(
ofType<UpdateTodo>('UPDATE_TODO'),
withLatestFrom(this.s.store),
pessimisticUpdate({
run: (a, state) => ({
type: 'TODO_UPDATED',
payload: { user: state.user, newTitle: a.payload.newTitle }
}),
onError: (a, e: any) => null
})
);
constructor(private s: DataPersistence<TodosState>) {}
}
function userReducer() {
return 'bob';
}
let actions: Observable<any>;
beforeEach(() => {
actions = new Subject<any>();
TestBed.configureTestingModule({
providers: [TodoEffects, provideMockActions(() => actions)],
imports: [StoreModule.forRoot({ user: userReducer })]
});
});
it('should work', async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
expect(await readAll(TestBed.get(TodoEffects).loadTodo)).toEqual([
{
type: 'TODO_UPDATED',
payload: { user: 'bob', newTitle: 'newTitle' }
}
]);
done();
});
it('should work with an operator', async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
expect(
await readAll(TestBed.get(TodoEffects).loadTodoWithOperator)
).toEqual([
{
type: 'TODO_UPDATED',
payload: { user: 'bob', newTitle: 'newTitle' }
}
]);
done();
});
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, state) => ({
type: 'TODO_UPDATED',
payload: { user: state.user, newTitle: a.payload.newTitle }
}) | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, state) => ({
type: 'TODO_UPDATED',
payload: { user: state.user, newTitle: a.payload.newTitle }
}) | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
expect(await readAll(TestBed.get(TodoEffects).loadTodo)).toEqual([
{
type: 'TODO_UPDATED',
payload: { user: 'bob', newTitle: 'newTitle' }
}
]);
done();
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
expect(
await readAll(TestBed.get(TodoEffects).loadTodoWithOperator)
).toEqual([
{
type: 'TODO_UPDATED',
payload: { user: 'bob', newTitle: 'newTitle' }
}
]);
done();
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.pessimisticUpdate<UpdateTodo>('UPDATE_TODO', {
run: (a, state) => {
throw new Error('boom');
},
onError: (a, e: any) => ({
type: 'ERROR',
payload: { error: e }
})
});
constructor(private s: DataPersistence<TodosState>) {}
}
function userReducer() {
return 'bob';
}
let actions: Observable<any>;
beforeEach(() => {
actions = new Subject<any>();
TestBed.configureTestingModule({
providers: [TodoEffects, provideMockActions(() => actions)],
imports: [StoreModule.forRoot({ user: userReducer })]
});
});
it('should work', async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
const [a]: any = await readAll(TestBed.get(TodoEffects).loadTodo);
expect(a.type).toEqual('ERROR');
expect(a.payload.error.message).toEqual('boom');
done();
});
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, state) => {
throw new Error('boom');
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, e: any) => ({
type: 'ERROR',
payload: { error: e }
}) | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
const [a]: any = await readAll(TestBed.get(TodoEffects).loadTodo);
expect(a.type).toEqual('ERROR');
expect(a.payload.error.message).toEqual('boom');
done();
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.pessimisticUpdate<UpdateTodo>('UPDATE_TODO', {
run: (a, state) => {
return throwError('boom');
},
onError: (a, e: any) => ({
type: 'ERROR',
payload: { error: e }
})
});
constructor(private s: DataPersistence<TodosState>) {}
}
function userReducer() {
return 'bob';
}
let actions: Observable<any>;
beforeEach(() => {
actions = new Subject<any>();
TestBed.configureTestingModule({
providers: [TodoEffects, provideMockActions(() => actions)],
imports: [StoreModule.forRoot({ user: userReducer })]
});
});
it('should work', async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
const [a]: any = await readAll(TestBed.get(TodoEffects).loadTodo);
expect(a.type).toEqual('ERROR');
expect(a.payload.error).toEqual('boom');
done();
});
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, state) => {
return throwError('boom');
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
const [a]: any = await readAll(TestBed.get(TodoEffects).loadTodo);
expect(a.type).toEqual('ERROR');
expect(a.payload.error).toEqual('boom');
done();
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
beforeEach(() => {
TestBed.configureTestingModule({ providers: [DataPersistence] });
});
describe('`run` throws an error', () => {
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.optimisticUpdate<UpdateTodo>('UPDATE_TODO', {
run: (a, state) => {
throw new Error('boom');
},
undoAction: (a, e: any) => ({
type: 'UNDO_UPDATE_TODO',
payload: a.payload
})
});
@Effect()
loadTodoWithOperator = this.s.actions.pipe(
ofType<UpdateTodo>('UPDATE_TODO'),
withLatestFrom(this.s.store),
optimisticUpdate({
run: (a, state) => {
throw new Error('boom');
},
undoAction: (a, e: any) => ({
type: 'UNDO_UPDATE_TODO',
payload: a.payload
})
})
);
constructor(private s: DataPersistence<TodosState>) {}
}
function userReducer() {
return 'bob';
}
let actions: Observable<any>;
beforeEach(() => {
actions = new Subject<any>();
TestBed.configureTestingModule({
providers: [TodoEffects, provideMockActions(() => actions)],
imports: [StoreModule.forRoot({ user: userReducer })]
});
});
it('should work', async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
const [a]: any = await readAll(TestBed.get(TodoEffects).loadTodo);
expect(a.type).toEqual('UNDO_UPDATE_TODO');
expect(a.payload.newTitle).toEqual('newTitle');
done();
});
it('should work with an operator', async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
const [a]: any = await readAll(
TestBed.get(TodoEffects).loadTodoWithOperator
);
expect(a.type).toEqual('UNDO_UPDATE_TODO');
expect(a.payload.newTitle).toEqual('newTitle');
done();
});
});
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
() => {
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.optimisticUpdate<UpdateTodo>('UPDATE_TODO', {
run: (a, state) => {
throw new Error('boom');
},
undoAction: (a, e: any) => ({
type: 'UNDO_UPDATE_TODO',
payload: a.payload
})
});
@Effect()
loadTodoWithOperator = this.s.actions.pipe(
ofType<UpdateTodo>('UPDATE_TODO'),
withLatestFrom(this.s.store),
optimisticUpdate({
run: (a, state) => {
throw new Error('boom');
},
undoAction: (a, e: any) => ({
type: 'UNDO_UPDATE_TODO',
payload: a.payload
})
})
);
constructor(private s: DataPersistence<TodosState>) {}
}
function userReducer() {
return 'bob';
}
let actions: Observable<any>;
beforeEach(() => {
actions = new Subject<any>();
TestBed.configureTestingModule({
providers: [TodoEffects, provideMockActions(() => actions)],
imports: [StoreModule.forRoot({ user: userReducer })]
});
});
it('should work', async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
const [a]: any = await readAll(TestBed.get(TodoEffects).loadTodo);
expect(a.type).toEqual('UNDO_UPDATE_TODO');
expect(a.payload.newTitle).toEqual('newTitle');
done();
});
it('should work with an operator', async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
const [a]: any = await readAll(
TestBed.get(TodoEffects).loadTodoWithOperator
);
expect(a.type).toEqual('UNDO_UPDATE_TODO');
expect(a.payload.newTitle).toEqual('newTitle');
done();
});
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, e: any) => ({
type: 'UNDO_UPDATE_TODO',
payload: a.payload
}) | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, state) => {
throw new Error('boom');
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
(a, e: any) => ({
type: 'UNDO_UPDATE_TODO',
payload: a.payload
}) | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
const [a]: any = await readAll(TestBed.get(TodoEffects).loadTodo);
expect(a.type).toEqual('UNDO_UPDATE_TODO');
expect(a.payload.newTitle).toEqual('newTitle');
done();
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
async done => {
actions = of({
type: 'UPDATE_TODO',
payload: { newTitle: 'newTitle' }
});
const [a]: any = await readAll(
TestBed.get(TodoEffects).loadTodoWithOperator
);
expect(a.type).toEqual('UNDO_UPDATE_TODO');
expect(a.payload.newTitle).toEqual('newTitle');
done();
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ClassDeclaration |
@Component({
template: `
ROOT[<router-outlet></router-outlet>]
`
})
class RootCmp {} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ClassDeclaration |
@Component({
template: `
Todo [
<div *ngIf="(todo | async) as t">ID {{ t.id }} User {{ t.user }}</div>
]
`
})
class TodoComponent {
todo = this.store.select('todos', 'selected');
constructor(private store: Store<TodosState>) {}
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ClassDeclaration |
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.navigation(TodoComponent, {
run: (a, state) => {
return {
type: 'TODO_LOADED',
payload: { id: a.params['id'], user: state.user }
};
},
onError: () => null
});
constructor(private s: DataPersistence<TodosState>) {}
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ClassDeclaration |
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.navigation(TodoComponent, {
run: (a, state) => {
if (a.params['id'] === '123') {
throw new Error('boom');
} else {
return {
type: 'TODO_LOADED',
payload: { id: a.params['id'], user: state.user }
};
}
},
onError: (a, e) => ({ type: 'ERROR', payload: { error: e } })
});
constructor(private s: DataPersistence<TodosState>) {}
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ClassDeclaration |
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.navigation(TodoComponent, {
run: (a, state) => {
if (a.params['id'] === '123') {
return throwError('boom');
} else {
return {
type: 'TODO_LOADED',
payload: { id: a.params['id'], user: state.user }
};
}
},
onError: (a, e) => ({ type: 'ERROR', payload: { error: e } })
});
constructor(private s: DataPersistence<TodosState>) {}
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ClassDeclaration |
@Injectable()
class TodoEffects {
@Effect()
loadTodos = this.s.fetch<GetTodos>('GET_TODOS', {
run: (a, state) => {
// we need to introduce the delay to "enable" switchMap
return of({
type: 'TODOS',
payload: { user: state.user, todos: 'some todos' }
}).pipe(delay(1));
},
onError: (a, e: any) => null
});
@Effect()
loadTodosWithOperator = this.s.actions.pipe(
ofType<GetTodos>('GET_TODOS'),
withLatestFrom(this.s.store),
fetch({
run: (action, state) => {
return of({
type: 'TODOS',
payload: { user: state.user, todos: 'some todos' }
}).pipe(delay(1));
}
})
);
constructor(private s: DataPersistence<TodosState>) {}
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ClassDeclaration |
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.fetch<GetTodo>('GET_TODO', {
id: (a, state) => a.payload.id,
run: (a, state) =>
of({ type: 'TODO', payload: a.payload }).pipe(delay(1)),
onError: (a, e: any) => null
});
constructor(private s: DataPersistence<TodosState>) {}
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ClassDeclaration |
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.pessimisticUpdate<UpdateTodo>('UPDATE_TODO', {
run: (a, state) => ({
type: 'TODO_UPDATED',
payload: { user: state.user, newTitle: a.payload.newTitle }
}),
onError: (a, e: any) => null
});
@Effect()
loadTodoWithOperator = this.s.actions.pipe(
ofType<UpdateTodo>('UPDATE_TODO'),
withLatestFrom(this.s.store),
pessimisticUpdate({
run: (a, state) => ({
type: 'TODO_UPDATED',
payload: { user: state.user, newTitle: a.payload.newTitle }
}),
onError: (a, e: any) => null
})
);
constructor(private s: DataPersistence<TodosState>) {}
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ClassDeclaration |
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.pessimisticUpdate<UpdateTodo>('UPDATE_TODO', {
run: (a, state) => {
throw new Error('boom');
},
onError: (a, e: any) => ({
type: 'ERROR',
payload: { error: e }
})
});
constructor(private s: DataPersistence<TodosState>) {}
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ClassDeclaration |
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.pessimisticUpdate<UpdateTodo>('UPDATE_TODO', {
run: (a, state) => {
return throwError('boom');
},
onError: (a, e: any) => ({
type: 'ERROR',
payload: { error: e }
})
});
constructor(private s: DataPersistence<TodosState>) {}
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ClassDeclaration |
@Injectable()
class TodoEffects {
@Effect()
loadTodo = this.s.optimisticUpdate<UpdateTodo>('UPDATE_TODO', {
run: (a, state) => {
throw new Error('boom');
},
undoAction: (a, e: any) => ({
type: 'UNDO_UPDATE_TODO',
payload: a.payload
})
});
@Effect()
loadTodoWithOperator = this.s.actions.pipe(
ofType<UpdateTodo>('UPDATE_TODO'),
withLatestFrom(this.s.store),
optimisticUpdate({
run: (a, state) => {
throw new Error('boom');
},
undoAction: (a, e: any) => ({
type: 'UNDO_UPDATE_TODO',
payload: a.payload
})
})
);
constructor(private s: DataPersistence<TodosState>) {}
} | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
TypeAliasDeclaration | // interfaces
type Todo = {
id: number;
user: string;
}; | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
TypeAliasDeclaration |
type Todos = {
selected: Todo;
}; | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
TypeAliasDeclaration |
type TodosState = {
todos: Todos;
user: string;
}; | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
TypeAliasDeclaration | // actions
type TodoLoaded = {
type: 'TODO_LOADED';
payload: Todo;
}; | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
TypeAliasDeclaration |
type UpdateTodo = {
type: 'UPDATE_TODO';
payload: { newTitle: string };
}; | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
TypeAliasDeclaration |
type Action = TodoLoaded; | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
TypeAliasDeclaration |
type GetTodos = {
type: 'GET_TODOS';
}; | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
TypeAliasDeclaration |
type GetTodo = {
type: 'GET_TODO';
}; | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
TypeAliasDeclaration |
type GetTodo = {
type: 'GET_TODO';
payload: { id: string };
}; | Domratchev/nx | packages/nx/spec/data-persistence.spec.ts | TypeScript |
ArrowFunction |
()=>{
this.mcserivce.findAll().subscribe(
data => this.mclist=data
)
} | koyandemo/angularmc | src/app/pages/mc-service/mc-service-list/mc-service-list.component.ts | TypeScript |
ArrowFunction |
data => this.mclist=data | koyandemo/angularmc | src/app/pages/mc-service/mc-service-list/mc-service-list.component.ts | TypeScript |
ClassDeclaration |
@Component({
selector: 'app-mc-service-list',
templateUrl: './mc-service-list.component.html',
styleUrls: ['./mc-service-list.component.scss']
})
export class McServiceListComponent implements OnInit {
mclist:MasterCeremony[];
constructor(private mcserivce:McService,private route:Router) {
}
ngOnInit() {
setTimeout(()=>{
this.mcserivce.findAll().subscribe(
data => this.mclist=data
)
},500)
}
public onSelect(mc){
this.route.navigate(['mc-details',mc.name]);
}
} | koyandemo/angularmc | src/app/pages/mc-service/mc-service-list/mc-service-list.component.ts | TypeScript |
MethodDeclaration |
ngOnInit() {
setTimeout(()=>{
this.mcserivce.findAll().subscribe(
data => this.mclist=data
)
},500)
} | koyandemo/angularmc | src/app/pages/mc-service/mc-service-list/mc-service-list.component.ts | TypeScript |
MethodDeclaration |
public onSelect(mc){
this.route.navigate(['mc-details',mc.name]);
} | koyandemo/angularmc | src/app/pages/mc-service/mc-service-list/mc-service-list.component.ts | TypeScript |
ClassDeclaration |
export default class VideoChatBubble extends React.Component<VideoChatBubbleProps, VideoChatBubbleState> {
readonly state = {
fullscreen: false,
level: 0,
intervalId: 0
};
private readonly videoRef: RefObject<Video>;
constructor(props: VideoChatBubbleProps) {
super(props);
this.videoRef = React.createRef<Video>();
}
componentDidUpdate(prevProps: VideoChatBubbleProps, prevState: VideoChatBubbleState) {
if (prevProps.stream !== this.props.stream) {
return true;
} else {
return false;
}
}
private toggleFullScreen() {
this.setState({
fullscreen: !this.state.fullscreen
})
}
render() {
const { stream, index } = this.props;
const { fullscreen } = this.state;
const video = <Video ref={this.videoRef} className={fullscreen ? 'video-fullscreen' : 'bubble-video'} stream={stream}
key="small" id={fullscreen ? '' : 'small' + index} muted={this.props.muted}/>;
return (
<div className={fullscreen ? 'video-fullscreen-wrapper' : 'video-small-wrapper'}>
<div className={fullscreen ? 'overlay overlay-fullscreen' : 'overlay overlay-small'} onClick={() => this.toggleFullScreen()} | ThibaudREY/conferly | client/src/Components/VideoChat/VideoChatBubble/index.tsx | TypeScript |
InterfaceDeclaration |
interface VideoChatBubbleProps {
stream: Promise<MediaStream>
className?: string
index: number
muted: boolean
} | ThibaudREY/conferly | client/src/Components/VideoChat/VideoChatBubble/index.tsx | TypeScript |
InterfaceDeclaration |
interface VideoChatBubbleState {
fullscreen: boolean
level: number
intervalId?: number
} | ThibaudREY/conferly | client/src/Components/VideoChat/VideoChatBubble/index.tsx | TypeScript |
MethodDeclaration |
componentDidUpdate(prevProps: VideoChatBubbleProps, prevState: VideoChatBubbleState) {
if (prevProps.stream !== this.props.stream) {
return true;
} else {
return false;
}
} | ThibaudREY/conferly | client/src/Components/VideoChat/VideoChatBubble/index.tsx | TypeScript |
MethodDeclaration |
private toggleFullScreen() {
this.setState({
fullscreen: !this.state.fullscreen
})
} | ThibaudREY/conferly | client/src/Components/VideoChat/VideoChatBubble/index.tsx | TypeScript |
MethodDeclaration |
render() {
const { stream, index } = this.props;
const { fullscreen } = this.state;
const video = <Video ref={this.videoRef} className={fullscreen ? 'video-fullscreen' : 'bubble-video'} stream={stream}
key="small" id={fullscreen ? '' : 'small' + index} muted={this.props.muted}/>;
return (
<div className={fullscreen ? 'video-fullscreen-wrapper' : 'video-small-wrapper'}>
<div className={fullscreen ? 'overlay overlay-fullscreen' : 'overlay overlay-small'} onClick={() => this.toggleFullScreen()} | ThibaudREY/conferly | client/src/Components/VideoChat/VideoChatBubble/index.tsx | TypeScript |
MethodDeclaration |
fullscreen ? <FaCompress | ThibaudREY/conferly | client/src/Components/VideoChat/VideoChatBubble/index.tsx | TypeScript |
FunctionDeclaration |
function Session(props: SessionsData){
return (
<Link className={styles.program} to={`/workshops/${props.id}`} | livarb/javazone-2021 | src/pages/Workshop/Workshop.tsx | TypeScript |
FunctionDeclaration |
function Sessions(props: {data: [SessionsData]}){
const sessions = props.data.filter(s => s.format === "workshop")
const orderedSession = sessions.sort(
(a,b) => {
if (a.length < b.length) {
return 1
}
return -1
})
return <> {
orderedSession.map(s => <Session {...s}/>)
} </>
} | livarb/javazone-2021 | src/pages/Workshop/Workshop.tsx | TypeScript |
FunctionDeclaration |
export function Workshop() {
const {data} = useFetch<ProgramData>("https://sleepingpill.javazone.no/public/allSessions/javazone_2021")
return <div className={styles.container}>
{!!data && <Sessions data={data.sessions}/>}
</div>
} | livarb/javazone-2021 | src/pages/Workshop/Workshop.tsx | TypeScript |
ArrowFunction |
speaker => speaker.name | livarb/javazone-2021 | src/pages/Workshop/Workshop.tsx | TypeScript |
ArrowFunction |
s => s.format === "workshop" | livarb/javazone-2021 | src/pages/Workshop/Workshop.tsx | TypeScript |
ArrowFunction |
(a,b) => {
if (a.length < b.length) {
return 1
}
return -1
} | livarb/javazone-2021 | src/pages/Workshop/Workshop.tsx | TypeScript |
ArrowFunction |
s => <Session {...s}/> | livarb/javazone-2021 | src/pages/Workshop/Workshop.tsx | TypeScript |
ClassDeclaration |
@NgModule({
imports: [
ComponentsModule,
FormsModule,
BrowserModule,
],
declarations: [
]
})
export class ViewsModule { } | alephzed/myTodoAngularApp | src/client/app/view_system/views/index.ts | TypeScript |
InterfaceDeclaration |
export interface QlikConfigInterface {
useWss: boolean;
address: string;
port: number;
} | goekaypamuk/angular-engine-api | src/interface/qlik-config.interface.ts | TypeScript |
FunctionDeclaration |
export default function SignIn(props: Props) {
const {title, type} = props
return(
<Root>
<Step active={true} completed={false}>
<StepIcon icon={<div><LockIcon /></div>} />
<StepLabel>
{title ? title : 'Please sign in.'}
</StepLabel>
</Step>
<SignInForm type={type} />
</Root>
)
} | PATRIC3/p3-ui-prototype | src/auth/SignIn.tsx | TypeScript |
TypeAliasDeclaration |
type Props = {
title?: string
type?: 'service' | 'workspace'
} | PATRIC3/p3-ui-prototype | src/auth/SignIn.tsx | TypeScript |
ArrowFunction |
(mark: Mark): ComponentType<any> => {
return markToReact[mark.type.name];
} | HereSinceres/atlaskit-mk-2 | packages/editor/renderer/src/react/marks/index.ts | TypeScript |
ArrowFunction |
(Base: typeof BackendUser) => {
class User extends Routable(Base) {
['constructor']!: typeof User;
@consume() static Session: ReturnType<typeof Session>;
@consume() static Home: typeof Home;
@consume() static Common: typeof Common;
@route('/sign-up') @view() static SignUp() {
const {Session, Home} = this;
if (Session.user) {
Home.Main.redirect();
return null;
}
const user = new (this.fork())();
return <user.SignUp />;
}
@view() SignUp() {
const {Home, Common} = this.constructor;
const [inviteToken, setInviteToken] = useState('');
const [handleSignUp, isSigningUp, signingUpError] = useAsyncCallback(async () => {
await this.signUp({inviteToken});
Home.Main.reload();
}, [inviteToken]);
return (
<Common.Layout title="Sign up" width="400px">
<h2>Sign Up</h2>
{signingUpError && <Common.ErrorMessage error={signingUpError} />}
<form
onSubmit={(event) | Igsu-Bravo/layr | website/frontend/src/components/user.tsx | TypeScript |
ArrowFunction |
async () => {
await this.signUp({inviteToken});
Home.Main.reload();
} | Igsu-Bravo/layr | website/frontend/src/components/user.tsx | TypeScript |
ArrowFunction |
async () => {
await this.signIn();
Home.Main.reload();
} | Igsu-Bravo/layr | website/frontend/src/components/user.tsx | TypeScript |
ArrowFunction |
async () => {
return await this.generateInviteToken();
} | Igsu-Bravo/layr | website/frontend/src/components/user.tsx | TypeScript |
ClassDeclaration |
class User extends Routable(Base) {
['constructor']!: typeof User;
@consume() static Session: ReturnType<typeof Session>;
@consume() static Home: typeof Home;
@consume() static Common: typeof Common;
@route('/sign-up') @view() static SignUp() {
const {Session, Home} = this;
if (Session.user) {
Home.Main.redirect();
return null;
}
const user = new (this.fork())();
return <user.SignUp />;
}
@view() SignUp() {
const {Home, Common} = this.constructor;
const [inviteToken, setInviteToken] = useState('');
const [handleSignUp, isSigningUp, signingUpError] = useAsyncCallback(async () => {
await this.signUp({inviteToken});
Home.Main.reload();
}, [inviteToken]);
return (
<Common.Layout title="Sign up" width="400px">
<h2>Sign Up</h2>
{signingUpError && <Common.ErrorMessage error={signingUpError} />}
<form
onSubmit={(event) | Igsu-Bravo/layr | website/frontend/src/components/user.tsx | TypeScript |
MethodDeclaration |
@route('/sign-up') @view() static SignUp() {
const {Session, Home} = this;
if (Session.user) {
Home.Main.redirect();
return null;
}
const user = new (this.fork())();
return <user.SignUp />;
} | Igsu-Bravo/layr | website/frontend/src/components/user.tsx | TypeScript |
MethodDeclaration |
@view() SignUp() {
const {Home, Common} = this.constructor;
const [inviteToken, setInviteToken] = useState('');
const [handleSignUp, isSigningUp, signingUpError] = useAsyncCallback(async () => {
await this.signUp({inviteToken});
Home.Main.reload();
}, [inviteToken]);
return (
<Common.Layout title="Sign up" width="400px">
<h2>Sign Up</h2>
{signingUpError && <Common.ErrorMessage error={signingUpError} />}
<form
onSubmit={(event) | Igsu-Bravo/layr | website/frontend/src/components/user.tsx | TypeScript |
InterfaceDeclaration |
export interface DateRange {
start?: string | Date;
end?: string | Date;
} | Sage-Bionetworks/rocc-app | src/app/shared/filters/date-range-filter/date-range.ts | TypeScript |
Subsets and Splits