type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
|---|---|---|---|---|
MethodDeclaration
|
private serialize(input: TagResourceCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_json1_1TagResourceCommand(input, context);
}
|
justingrant/aws-sdk-js-v3
|
clients/client-kms/commands/TagResourceCommand.ts
|
TypeScript
|
MethodDeclaration
|
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<TagResourceCommandOutput> {
return deserializeAws_json1_1TagResourceCommand(output, context);
}
|
justingrant/aws-sdk-js-v3
|
clients/client-kms/commands/TagResourceCommand.ts
|
TypeScript
|
ClassDeclaration
|
@NgModule({
declarations: [FormComponent, ListComponent],
imports: [CommonModule, ClientsRoutingModule, FormsModule],
exports: [FormComponent, ListComponent],
})
export class ClientsModule {}
|
jvcalassio/service-provider-dashboard
|
angular-frontend/src/app/clients/clients.module.ts
|
TypeScript
|
ArrowFunction
|
(router: Router): void => {
router.route('/survey')
.post(adaptMiddleware(makeAuthMiddleware('admin')), adaptController(makeAddSurveyController()))
.get(adaptMiddleware(makeAuthMiddleware()), adaptController(makeListSurveysController()))
}
|
Mist3rBru/clean-ts-api
|
src/main/routes/survey-routes.ts
|
TypeScript
|
FunctionDeclaration
|
function test_fetchRetryWithUrlString() {
const options: fetchRetry.Options = {
retryOptions: {
retryMaxDuration: 10000,
retryInitialDelay: 3000,
retryOnHttpResponse: (_response: Response): boolean => (true),
retryBackoff: 2,
socketTimeout: 60000,
forceSocketTimeout: false
}
};
fetchRetry("http://something.com/", options);
}
|
0-Captain/DefinitelyTyped
|
types/adobe__node-fetch-retry/adobe__node-fetch-retry-tests.ts
|
TypeScript
|
FunctionDeclaration
|
function test_fetchRetryWithRequestString() {
const request = new Request("http://something.com", {
method: "GET",
headers: {
"Content-Type" : "application/json"
}
});
const options: fetchRetry.Options = {
retryOptions: {
retryMaxDuration: 10000,
retryInitialDelay: 3000,
retryOnHttpResponse: (_response: Response): boolean => true,
retryBackoff: 2,
socketTimeout: 60000,
forceSocketTimeout: false,
},
};
fetchRetry(request, options);
}
|
0-Captain/DefinitelyTyped
|
types/adobe__node-fetch-retry/adobe__node-fetch-retry-tests.ts
|
TypeScript
|
FunctionDeclaration
|
function test_fetchRetryWithUrlStringAndFurtherOptions() {
const options: fetchRetry.Options = {
headers: {
"Content-Type" : "application/json"
},
method: "GET",
retryOptions: {
retryMaxDuration: 10000,
retryInitialDelay: 3000,
retryOnHttpResponse: (_response: Response): boolean => true,
retryBackoff: 2,
socketTimeout: 60000,
forceSocketTimeout: false,
},
};
fetchRetry('http://something.com/', options);
}
|
0-Captain/DefinitelyTyped
|
types/adobe__node-fetch-retry/adobe__node-fetch-retry-tests.ts
|
TypeScript
|
ArrowFunction
|
(_response: Response): boolean => (true)
|
0-Captain/DefinitelyTyped
|
types/adobe__node-fetch-retry/adobe__node-fetch-retry-tests.ts
|
TypeScript
|
ArrowFunction
|
(_response: Response): boolean => true
|
0-Captain/DefinitelyTyped
|
types/adobe__node-fetch-retry/adobe__node-fetch-retry-tests.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type UserState = {
voice: boolean;
unmuted: boolean;
raised_hand: number;
}
|
Willyfrog/mattermost-plugin-calls
|
webapp/src/types/types.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('checkMissingSteamIds', async () => {
const players = [
createPlayer('Test1', '1'),
createPlayer('Test2', '2'),
createPlayer('Test3', '3'),
createPlayer('Test4', '4'),
];
players[0].setSteamId('123');
const res = await checkMissingSteamIds(players);
expect(res.length).toEqual(3);
});
afterAll(() => {
getClientReference().destroy();
});
}
|
Lolispo/inhouseBot
|
tests/steamid.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const players = [
createPlayer('Test1', '1'),
createPlayer('Test2', '2'),
createPlayer('Test3', '3'),
createPlayer('Test4', '4'),
];
players[0].setSteamId('123');
const res = await checkMissingSteamIds(players);
expect(res.length).toEqual(3);
}
|
Lolispo/inhouseBot
|
tests/steamid.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
getClientReference().destroy();
}
|
Lolispo/inhouseBot
|
tests/steamid.test.ts
|
TypeScript
|
ArrowFunction
|
(config: BudgetsClientConfig) => {
const browserDefaults = getBrowserRuntimeConfig(config);
return {
...browserDefaults,
...config,
runtime: "react-native",
sha256: config?.sha256 ?? Sha256,
};
}
|
christophgysin/aws-sdk-js-v3
|
clients/client-budgets/runtimeConfig.native.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('rejects with left if TaskEither is left', async () => {
const task = tryCatch(() => Promise.reject(new Error('whoops')), String);
await expect(toPromise(task)).rejects.toEqual('Error: whoops');
});
it('resolves with right if TaskEither is right', async () => {
const task = tryCatch(() => Promise.resolve('success'), String);
await expect(toPromise(task)).resolves.toEqual('success');
});
}
|
AlexanderWert/kibana
|
x-pack/plugins/lists/public/common/fp_utils.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const task = tryCatch(() => Promise.reject(new Error('whoops')), String);
await expect(toPromise(task)).rejects.toEqual('Error: whoops');
}
|
AlexanderWert/kibana
|
x-pack/plugins/lists/public/common/fp_utils.test.ts
|
TypeScript
|
ArrowFunction
|
() => Promise.reject(new Error('whoops'))
|
AlexanderWert/kibana
|
x-pack/plugins/lists/public/common/fp_utils.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const task = tryCatch(() => Promise.resolve('success'), String);
await expect(toPromise(task)).resolves.toEqual('success');
}
|
AlexanderWert/kibana
|
x-pack/plugins/lists/public/common/fp_utils.test.ts
|
TypeScript
|
ArrowFunction
|
() => Promise.resolve('success')
|
AlexanderWert/kibana
|
x-pack/plugins/lists/public/common/fp_utils.test.ts
|
TypeScript
|
ClassDeclaration
|
export class HelloWorldTask extends TaskBase<IMessage> {
public async execute(message: IMessage): Promise<IMessage> {
const { properties } = message;
console.log(`Executing task: ${properties.activityId}`);
console.log(`${properties.bpmnProcessId}::${properties.processInstanceId} Servus!`);
const response = await axios.get('https://jsonplaceholder.typicode.com/todos/1');
console.log('\ndata:');
console.log(response.data);
return message;
}
}
|
sylvain-bouchard/workit
|
examples/basic/tasks/helloWorldTask.ts
|
TypeScript
|
MethodDeclaration
|
public async execute(message: IMessage): Promise<IMessage> {
const { properties } = message;
console.log(`Executing task: ${properties.activityId}`);
console.log(`${properties.bpmnProcessId}::${properties.processInstanceId} Servus!`);
const response = await axios.get('https://jsonplaceholder.typicode.com/todos/1');
console.log('\ndata:');
console.log(response.data);
return message;
}
|
sylvain-bouchard/workit
|
examples/basic/tasks/helloWorldTask.ts
|
TypeScript
|
FunctionDeclaration
|
export default function shuffle<T>(a: Array<T>): Array<T> {
let j, x, i;
for (i = a.length - 1; i > 0; i--) {
j = Math.floor(Math.random() * (i + 1));
x = a[i];
a[i] = a[j];
a[j] = x;
}
return a;
}
|
KiOui/drankspel
|
frontend/src/util/shuffle.ts
|
TypeScript
|
ArrowFunction
|
() => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [AdminAuthGuardService]
});
});
it('should be created', inject([AdminAuthGuardService], (service: AdminAuthGuardService) => {
expect(service).toBeTruthy();
}));
}
|
djtorel/camc-udemy
|
11-Authentication-Authorization/01-Section-Work/authentication/src/app/services/admin-auth-guard.service.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
TestBed.configureTestingModule({
providers: [AdminAuthGuardService]
});
}
|
djtorel/camc-udemy
|
11-Authentication-Authorization/01-Section-Work/authentication/src/app/services/admin-auth-guard.service.spec.ts
|
TypeScript
|
ArrowFunction
|
(service: AdminAuthGuardService) => {
expect(service).toBeTruthy();
}
|
djtorel/camc-udemy
|
11-Authentication-Authorization/01-Section-Work/authentication/src/app/services/admin-auth-guard.service.spec.ts
|
TypeScript
|
ClassDeclaration
|
@Component({
selector: 'app-post',
templateUrl: './post.component.html',
styleUrls: ['./post.component.scss']
})
export class PostComponent implements OnInit {
constructor(public override:OverrideService) { }
ngOnInit(): void {
}
}
|
overrideEg/upgraded-EWJ
|
ewj-website/src/app/landing-page/layout/post/post.component.ts
|
TypeScript
|
FunctionDeclaration
|
export declare function GetChildIndex<T extends IGameObject>(child: T): number;
|
Mattykins/phaser-1
|
dist/display/GetChildIndex.d.ts
|
TypeScript
|
FunctionDeclaration
|
export function generateUUID(): string {
return crypto.randomBytes(16).toString('hex');
}
|
ApteroSAS/axolotis-core-plugins
|
src/tests/playwright/baseFixtures.ts
|
TypeScript
|
ArrowFunction
|
async ({ context }, use) => {
await context.addInitScript(() =>
window.addEventListener('beforeunload', () =>
(window as any).collectIstanbulCoverage(JSON.stringify((window as any).__coverage__))
),
);
await fs.promises.mkdir(istanbulCLIOutput, { recursive: true });
await context.exposeFunction('collectIstanbulCoverage', (coverageJSON: string) => {
if (coverageJSON)
fs.writeFileSync(path.join(istanbulCLIOutput, `playwright_coverage_${generateUUID()}.json`), coverageJSON);
});
await use(context);
for (const page of context.pages()) {
await page.evaluate(() => (window as any).collectIstanbulCoverage(JSON.stringify((window as any).__coverage__)))
await page.close();
}
}
|
ApteroSAS/axolotis-core-plugins
|
src/tests/playwright/baseFixtures.ts
|
TypeScript
|
ArrowFunction
|
() =>
window.addEventListener('beforeunload', () =>
(window as any).collectIstanbulCoverage(JSON.stringify((window as any).__coverage__))
)
|
ApteroSAS/axolotis-core-plugins
|
src/tests/playwright/baseFixtures.ts
|
TypeScript
|
ArrowFunction
|
() =>
(window as any).collectIstanbulCoverage(JSON.stringify((window as any).__coverage__))
|
ApteroSAS/axolotis-core-plugins
|
src/tests/playwright/baseFixtures.ts
|
TypeScript
|
ArrowFunction
|
(coverageJSON: string) => {
if (coverageJSON)
fs.writeFileSync(path.join(istanbulCLIOutput, `playwright_coverage_${generateUUID()}.json`), coverageJSON);
}
|
ApteroSAS/axolotis-core-plugins
|
src/tests/playwright/baseFixtures.ts
|
TypeScript
|
ArrowFunction
|
() => (window as any).collectIstanbulCoverage(JSON.stringify((window as any).__coverage__))
|
ApteroSAS/axolotis-core-plugins
|
src/tests/playwright/baseFixtures.ts
|
TypeScript
|
ArrowFunction
|
frame => JSON.stringify(frame)
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
ClassDeclaration
|
export class Recorder {
private isPaused: boolean = false;
private childProcess: pty.IPty;
private onDataHandlers: ((data: string) => void)[] = [];
private onExitHandlers: ((exitCode: number, signal: string | number) => void)[] = [];
private startTime: number;
private recording: Recording;
private cwd: string;
private exitCode: number | undefined;
constructor(
private cmd: string,
private args: string[],
private options: any,
cwd?: string,
private cols: number = 120,
private rows: number = 30,
) {
this.exitCode = undefined;
this.cwd = options.cwd || process.cwd();
this.recording = {
header: {
version: 2,
width: cols,
height: rows,
timestamp: null,
title: 'Recording',
env: {},
},
frames: [],
};
}
run() {
this.startTime = Date.now();
if (this.exitCode !== undefined) {
throw new Error('Already executed. Please start a new instance');
}
this.childProcess = pty.spawn(this.cmd, this.args, {
name: 'xterm-color',
cols: this.cols,
rows: this.rows,
cwd: this.cwd,
...this.options,
});
this.addFrame(this.renderPrompt(this.cwd, this.cmd, this.args));
this.childProcess.onData(this.onData.bind(this));
this.childProcess.onExit(this.onExit.bind(this));
}
write(data: string): void {
if (this.childProcess && this.exitCode === undefined) {
this.childProcess.write(data);
return;
}
throw new Error('Can not write data. Program is either already executed or has not been run');
}
addOnDataHandler(fn: (content: string) => void) {
this.onDataHandlers.push(fn);
}
addOnExitHandlers(fn: (code: number, signal: string | number) => void) {
this.onExitHandlers.push(fn);
}
removeOnExitHandlers(fn: (code: number, signal: string | number) => void): boolean {
const idx = this.onExitHandlers.indexOf(fn);
if (idx === -1) {
return false;
}
this.onExitHandlers.splice(idx, 1);
return true;
}
getRecording(): string {
return [JSON.stringify(this.recording.header), ...this.recording.frames.map(frame => JSON.stringify(frame))].join('\n');
}
pauseRecording(): void {
this.isPaused = true;
}
kill() {
this.childProcess.kill();
}
sendEof() {
this.childProcess.write('\x04'); // ^D
}
resumeRecording(): void {
this.isPaused = false;
}
private onData(data: string) {
if (!this.isPaused) {
this.addFrame(data);
}
for (let handler of this.onDataHandlers) {
try {
handler(data);
} catch (e) {
// swallow
}
}
}
private onExit(status: { exitCode: number; signal: string | number }) {
this.exitCode = status.exitCode;
const length = (Date.now() - this.startTime) / 1000;
this.addFrame(this.renderPrompt(this.cwd));
this.recording.header.timestamp = length;
for (let handler of this.onExitHandlers) {
try {
handler(this.exitCode, status.signal);
} catch (e) {
// don't crash the recorder
}
}
}
private addFrame(data: string) {
this.recording.frames.push([(Date.now() - this.startTime) / 1000, 'o', data]);
}
private renderPrompt(cwd: string, cmd?: string, args?: string[]) {
const separator = '\u2b80';
const basePrompt = `${chalk.bgBlack('user@host') + chalk.black(separator)}${chalk.bgBlue(cwd) + chalk.blue(separator)}`;
const cmdPrompt = cmd ? `${cmd} ${args.length ? args.join(' ') : ''}` : '';
return `${basePrompt} ${cmdPrompt}\r\n`;
}
}
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type RecordingHeader = {
version: 2;
width: number;
height: number;
timestamp: number | null;
title: string;
env: any;
};
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type RecordingFrame = [number, 'o' | 'i', string];
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type Recording = {
header: RecordingHeader;
frames: RecordingFrame[];
};
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
MethodDeclaration
|
run() {
this.startTime = Date.now();
if (this.exitCode !== undefined) {
throw new Error('Already executed. Please start a new instance');
}
this.childProcess = pty.spawn(this.cmd, this.args, {
name: 'xterm-color',
cols: this.cols,
rows: this.rows,
cwd: this.cwd,
...this.options,
});
this.addFrame(this.renderPrompt(this.cwd, this.cmd, this.args));
this.childProcess.onData(this.onData.bind(this));
this.childProcess.onExit(this.onExit.bind(this));
}
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
MethodDeclaration
|
write(data: string): void {
if (this.childProcess && this.exitCode === undefined) {
this.childProcess.write(data);
return;
}
throw new Error('Can not write data. Program is either already executed or has not been run');
}
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
MethodDeclaration
|
addOnDataHandler(fn: (content: string) => void) {
this.onDataHandlers.push(fn);
}
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
MethodDeclaration
|
addOnExitHandlers(fn: (code: number, signal: string | number) => void) {
this.onExitHandlers.push(fn);
}
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
MethodDeclaration
|
removeOnExitHandlers(fn: (code: number, signal: string | number) => void): boolean {
const idx = this.onExitHandlers.indexOf(fn);
if (idx === -1) {
return false;
}
this.onExitHandlers.splice(idx, 1);
return true;
}
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
MethodDeclaration
|
getRecording(): string {
return [JSON.stringify(this.recording.header), ...this.recording.frames.map(frame => JSON.stringify(frame))].join('\n');
}
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
MethodDeclaration
|
pauseRecording(): void {
this.isPaused = true;
}
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
MethodDeclaration
|
kill() {
this.childProcess.kill();
}
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
MethodDeclaration
|
sendEof() {
this.childProcess.write('\x04'); // ^D
}
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
MethodDeclaration
|
resumeRecording(): void {
this.isPaused = false;
}
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
MethodDeclaration
|
private onData(data: string) {
if (!this.isPaused) {
this.addFrame(data);
}
for (let handler of this.onDataHandlers) {
try {
handler(data);
} catch (e) {
// swallow
}
}
}
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
MethodDeclaration
|
private onExit(status: { exitCode: number; signal: string | number }) {
this.exitCode = status.exitCode;
const length = (Date.now() - this.startTime) / 1000;
this.addFrame(this.renderPrompt(this.cwd));
this.recording.header.timestamp = length;
for (let handler of this.onExitHandlers) {
try {
handler(this.exitCode, status.signal);
} catch (e) {
// don't crash the recorder
}
}
}
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
MethodDeclaration
|
private addFrame(data: string) {
this.recording.frames.push([(Date.now() - this.startTime) / 1000, 'o', data]);
}
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
MethodDeclaration
|
private renderPrompt(cwd: string, cmd?: string, args?: string[]) {
const separator = '\u2b80';
const basePrompt = `${chalk.bgBlack('user@host') + chalk.black(separator)}${chalk.bgBlue(cwd) + chalk.blue(separator)}`;
const cmdPrompt = cmd ? `${cmd} ${args.length ? args.join(' ') : ''}` : '';
return `${basePrompt} ${cmdPrompt}\r\n`;
}
|
EringiV3/amplify-cli
|
packages/amplify-e2e-core/src/asciinema-recorder.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface IGraphRequestModel {
component_id: string;
nodes: IGraphRequestModel[];
}
|
Or-Geva/jfrog-client-js
|
model/Xray/Scan/GraphRequestModel.ts
|
TypeScript
|
FunctionDeclaration
|
export function getStylesFromClasses(
names: string | string[],
elementType: string = 'div'
): { [key: string]: string | number } {
let elem = document.createElement(elementType);
(typeof names == 'string' ? [names] : names).forEach(c => elem.classList.add(c));
let result = {};
for (let i = 0; i < document.styleSheets.length; i++) {
let sheet = document.styleSheets[i] as CSSStyleSheet;
let rules = sheet.rules || sheet.cssRules;
for (let j = 0; j < rules.length; j++) {
if (rules[j].type == CSSRule.STYLE_RULE) {
let styleRule = rules[j] as CSSStyleRule;
if (elem.matches(styleRule.selectorText)) {
for (let k = 0; k < styleRule.style.length; k++) {
result[styleRule.style[k]] = styleRule.style[styleRule.style[k]];
}
}
}
}
}
return result;
}
|
reyou/Ggg.Angular
|
apps/apps-books/Pro-Angular-6-3rd-Edition/part3-advanced-angular-features/chap28-Using-Animation/intro1-Preparing-the-Example-Project/exampleApp/src/app/core/animationUtils.ts
|
TypeScript
|
ArrowFunction
|
c => elem.classList.add(c)
|
reyou/Ggg.Angular
|
apps/apps-books/Pro-Angular-6-3rd-Edition/part3-advanced-angular-features/chap28-Using-Animation/intro1-Preparing-the-Example-Project/exampleApp/src/app/core/animationUtils.ts
|
TypeScript
|
ClassDeclaration
|
export class RequestsRepository {
// @ts-ignore
constructor(private baseurl: string) {
}
}
|
dex-it/react-native-template-dex
|
template/src/core/api/generated/RequestsRepository.g.ts
|
TypeScript
|
ArrowFunction
|
(item: any) => !item.isLayout
|
evgeniy-kryazhev/Events
|
reactjs/src/components/Layout/EventLayout.tsx
|
TypeScript
|
ArrowFunction
|
(item: any, index: number) => (
<Route key={index}
|
evgeniy-kryazhev/Events
|
reactjs/src/components/Layout/EventLayout.tsx
|
TypeScript
|
ClassDeclaration
|
class EventLayout extends React.Component<any> {
render() {
const {
location: { pathname },
} = this.props;
return (
<DocumentTitle title={utils.getPageTitle(pathname)}>
<Col className="container">
<div style={{ height: 'calc(100vh - 55px)' }}>
<div className={'lang'}>
<LanguageSelect />
</div>
<Switch>
{userRouter
.filter((item: any) => !item.isLayout)
.map((item: any, index: number) => (
<Route key={index} path={item.path} component={item.component} exact={item.exact} />
))}
<Redirect from="/user" to="/user/login" />
</Switch>
</div>
<Footer />
</Col>
</DocumentTitle>
);
}
}
|
evgeniy-kryazhev/Events
|
reactjs/src/components/Layout/EventLayout.tsx
|
TypeScript
|
MethodDeclaration
|
render() {
const {
location: { pathname },
} = this.props;
return (
<DocumentTitle title={utils.getPageTitle(pathname)}>
<Col className="container">
<div style={{ height: 'calc(100vh - 55px)' }}>
<div className={'lang'}>
<LanguageSelect />
</div>
<Switch>
{userRouter
.filter((item: any) => !item.isLayout)
.map((item: any, index: number) => (
<Route key={index} path={item.path} component={item.component} exact={item.exact} />
))}
<Redirect from="/user" to="/user/login" />
</Switch>
</div>
<Footer />
</Col>
</DocumentTitle>
);
}
|
evgeniy-kryazhev/Events
|
reactjs/src/components/Layout/EventLayout.tsx
|
TypeScript
|
ClassDeclaration
|
@ObjectType()
class Category {
@Field()
name: String;
@Field()
description: String;
@Field()
_id: String;
}
|
Lucas96Sousa/API-GraphQL-em-Node.js-e-TypeScript-com-TypeGraphQL
|
src/graphql/category/Category.ts
|
TypeScript
|
ArrowFunction
|
() => {
console.log('meow');
// return 'meow';
}
|
DJCordhose/lerna-playground
|
packages/my-app/src/index.tsx
|
TypeScript
|
ArrowFunction
|
() => {
console.log('bark');
}
|
DJCordhose/lerna-playground
|
packages/my-app/src/index.tsx
|
TypeScript
|
ClassDeclaration
|
// taken from: https://github.com/heruan/aurelia-breadcrumbs
@au.customElement("md-breadcrumbs")
@au.autoinject
export class MdBreadcrumbs {
constructor(private element: Element, private aureliaRouter: au.Router) { }
@au.bindable
router: au.Router;
childRouter: au.Router;
bind() {
if (!this.router) {
this.router = this.aureliaRouter;
}
this.childRouter = this.router;
let router = this.router;
while (router.parent) {
router = router.parent;
}
this.router = router;
}
navigate(navigationInstruction: au.NavigationInstruction) {
this.childRouter.navigateToRoute(navigationInstruction.config.name);
}
}
|
aurelia-ui-toolkits/aurelia-materialize-bridge
|
src/breadcrumbs/breadcrumbs.ts
|
TypeScript
|
MethodDeclaration
|
bind() {
if (!this.router) {
this.router = this.aureliaRouter;
}
this.childRouter = this.router;
let router = this.router;
while (router.parent) {
router = router.parent;
}
this.router = router;
}
|
aurelia-ui-toolkits/aurelia-materialize-bridge
|
src/breadcrumbs/breadcrumbs.ts
|
TypeScript
|
MethodDeclaration
|
navigate(navigationInstruction: au.NavigationInstruction) {
this.childRouter.navigateToRoute(navigationInstruction.config.name);
}
|
aurelia-ui-toolkits/aurelia-materialize-bridge
|
src/breadcrumbs/breadcrumbs.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface TabItem {
name: string;
url: string;
}
|
Aaron00101010/tab-manager-extension
|
src/typing.d.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface TabGroup {
id: string;
name: string;
tabs: TabItem[];
}
|
Aaron00101010/tab-manager-extension
|
src/typing.d.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface StorageConfig {
lang: Lang;
theme: Theme;
tabs: TabGroup[];
}
|
Aaron00101010/tab-manager-extension
|
src/typing.d.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type Theme = 'light' | 'dark' | 'system';
|
Aaron00101010/tab-manager-extension
|
src/typing.d.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type Lang = 'EN' | 'CN';
|
Aaron00101010/tab-manager-extension
|
src/typing.d.ts
|
TypeScript
|
ClassDeclaration
|
@Module({
imports: [],
controllers: [UsersController],
providers: [],
})
export class AppModule { }
|
dextto/book-nestjs-backend
|
user-service/ch3-controller/src/app.module.ts
|
TypeScript
|
ClassDeclaration
|
/**
* A concrete Geometry for supporting drawArrays.
*/
export declare class GeometryArrays extends GeometryBase {
/**
*
*/
private mode;
/**
* The <code>first</code> parameter in the drawArrays call.
* This is currently hard-code to zero because this class only supportes buffering one primitive.
*/
private first;
/**
* The <code>count</code> parameter in the drawArrays call.
* This is currently maintained at this level because this class only supportes buffering one primitive.
*/
private count;
/**
* The number of bytes for each element.
*
* This is used in the vertexAttribPointer method.
* Normally, we will use gl.FLOAT for each number which takes 4 bytes.
*/
private stride;
/**
*
*/
private pointers;
/**
*
*/
private vbo;
/**
*
*/
constructor(contextManager: ContextManager, primitive: Primitive, options?: {
order?: string[];
}, levelUp?: number);
/**
*
*/
protected resurrector(levelUp: number): void;
/**
*
*/
protected destructor(levelUp: number): void;
bind(material: Material): this;
draw(): this;
unbind(material: Material): this;
}
|
geometryzen/webgl-core
|
build/main/lib/core/GeometryArrays.d.ts
|
TypeScript
|
MethodDeclaration
|
/**
*
*/
protected resurrector(levelUp: number): void;
|
geometryzen/webgl-core
|
build/main/lib/core/GeometryArrays.d.ts
|
TypeScript
|
MethodDeclaration
|
/**
*
*/
protected destructor(levelUp: number): void;
|
geometryzen/webgl-core
|
build/main/lib/core/GeometryArrays.d.ts
|
TypeScript
|
MethodDeclaration
|
bind(material: Material): this;
|
geometryzen/webgl-core
|
build/main/lib/core/GeometryArrays.d.ts
|
TypeScript
|
MethodDeclaration
|
draw(): this;
|
geometryzen/webgl-core
|
build/main/lib/core/GeometryArrays.d.ts
|
TypeScript
|
MethodDeclaration
|
unbind(material: Material): this;
|
geometryzen/webgl-core
|
build/main/lib/core/GeometryArrays.d.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface AccessoriesInterface {
id: number;
name: string;
owner: number;
}
|
christian-gagliardi/accessories-jfp
|
src/accessories/interfaces/accessories.interface.ts
|
TypeScript
|
ArrowFunction
|
() => NovoChipsElement
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
ArrowFunction
|
(result) => {
for (const value of result) {
if (value.hasOwnProperty('label')) {
this.items.push({
value,
label: value.label,
});
} else if (this.source.options && Array.isArray(this.source.options)) {
this.items.push(this.getLabelFromOptions(value));
} else {
this.items.push(value);
}
}
this._items.next(this.items);
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
ArrowFunction
|
(val) => val.value === value
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
ArrowFunction
|
(val) => val.value === value.id
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
ArrowFunction
|
(i) => i.value
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
ClassDeclaration
|
@Component({
selector: 'chip,novo-chip',
template: `
<span (click)="onSelect($event)" (mouseenter)="onSelect($event)" (mouseleave)="onDeselect($event)" [ngClass]="_type">
<i *ngIf="_type" class="bhi-circle"></i>
<span><ng-content></ng-content></span>
</span>
<i class="bhi-close" *ngIf="!disabled" (click)="onRemove($event)"></i>
`,
})
export class NovoChipElement {
@Input()
set type(type: string) {
this._type = type ? type.toLowerCase() : null;
}
@Input()
disabled: boolean = false;
@Output()
select: EventEmitter<any> = new EventEmitter();
@Output()
remove: EventEmitter<any> = new EventEmitter();
@Output()
deselect: EventEmitter<any> = new EventEmitter();
entity: string;
_type: string;
onRemove(e) {
if (e) {
e.stopPropagation();
e.preventDefault();
}
this.remove.emit(e);
return false;
}
onSelect(e) {
if (e) {
e.stopPropagation();
e.preventDefault();
}
this.select.emit(e);
return false;
}
onDeselect(e) {
if (e) {
e.stopPropagation();
e.preventDefault();
}
this.deselect.emit(e);
return false;
}
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
MethodDeclaration
|
onRemove(e) {
if (e) {
e.stopPropagation();
e.preventDefault();
}
this.remove.emit(e);
return false;
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
MethodDeclaration
|
onSelect(e) {
if (e) {
e.stopPropagation();
e.preventDefault();
}
this.select.emit(e);
return false;
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
MethodDeclaration
|
onDeselect(e) {
if (e) {
e.stopPropagation();
e.preventDefault();
}
this.deselect.emit(e);
return false;
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
MethodDeclaration
|
ngOnInit() {
this.setItems();
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
MethodDeclaration
|
clearValue() {
this.items = [];
this._items.next(this.items);
this.value = null;
this.changed.emit({ value: this.value, rawValue: this.items });
this.onModelChange(this.value);
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
MethodDeclaration
|
setItems() {
this.items = [];
if (this.model && Array.isArray(this.model)) {
const noLabels = [];
for (const value of this.model) {
let label;
if (this.source && this.source.format && Helpers.validateInterpolationProps(this.source.format, value)) {
label = Helpers.interpolate(this.source.format, value);
}
if (this.source && label && label !== this.source.format) {
this.items.push({
value,
label,
});
} else if (this.source.getLabels && typeof this.source.getLabels === 'function') {
noLabels.push(value);
} else if (this.source.options && Array.isArray(this.source.options)) {
this.items.push(this.getLabelFromOptions(value));
} else if (this.source.categoryMap && this.source.categoryMap.size) {
this.items.push(value);
} else {
this.items.push({
value,
label: value,
});
}
}
if (noLabels.length > 0 && this.source && this.source.getLabels && typeof this.source.getLabels === 'function') {
this.source.getLabels(noLabels).then((result) => {
for (const value of result) {
if (value.hasOwnProperty('label')) {
this.items.push({
value,
label: value.label,
});
} else if (this.source.options && Array.isArray(this.source.options)) {
this.items.push(this.getLabelFromOptions(value));
} else {
this.items.push(value);
}
}
this._items.next(this.items);
});
}
}
this.changed.emit({ value: this.model, rawValue: this.items });
this._items.next(this.items);
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
MethodDeclaration
|
getLabelFromOptions(value) {
let id = value;
let optLabel = this.source.options.find((val) => val.value === value);
if (!optLabel && value.hasOwnProperty('id')) {
optLabel = this.source.options.find((val) => val.value === value.id);
id = value.id;
}
return {
value: id,
label: optLabel ? optLabel.label : value,
};
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
MethodDeclaration
|
deselectAll(event?) {
this.selected = null;
this.hidePreview();
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
MethodDeclaration
|
select(event?, item?) {
this.blur.emit(event);
this.deselectAll();
this.selected = item;
this.showPreview();
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
MethodDeclaration
|
deselect(event?, item?) {
this.blur.emit(event);
this.deselectAll();
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
MethodDeclaration
|
onTyping(event?) {
this.typing.emit(event);
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
MethodDeclaration
|
onFocus(event?) {
this.deselectAll();
this.element.nativeElement.classList.add('selected');
this.focus.emit(event);
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
MethodDeclaration
|
add(event) {
if (event && !(event instanceof Event)) {
this.items.push(event);
this.value = this.source && this.source.valueFormatter ? this.source.valueFormatter(this.items) : this.items.map((i) => i.value);
// Set focus on the picker
const input = this.element.nativeElement.querySelector('novo-picker > input');
if (input) {
input.focus();
}
}
this._items.next(this.items);
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
MethodDeclaration
|
remove(event, item) {
if (event) {
event.stopPropagation();
event.preventDefault();
}
this.items.splice(this.items.indexOf(item), 1);
this.deselectAll();
this.value = this.source && this.source.valueFormatter ? this.source.valueFormatter(this.items) : this.items.map((i) => i.value);
this.changed.emit({ value: this.value.length ? this.value : '', rawValue: this.items });
this.onModelChange(this.value.length ? this.value : '');
this._items.next(this.items);
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
MethodDeclaration
|
onKeyDown(event) {
if (event.keyCode === KeyCodes.BACKSPACE) {
if (event.target && event.target.value.length === 0 && this.items.length) {
if (event) {
event.stopPropagation();
event.preventDefault();
}
if (this.selected) {
this.remove(event, this.selected);
} else {
this.select(event, this.items[this.items.length - 1]);
}
}
}
}
|
bullhorn/novo-elements
|
projects/novo-elements/src/elements/chips/Chips.ts
|
TypeScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.