type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ClassDeclaration
@Component({ moduleId: module.id, selector: 'ripple-demo', templateUrl: 'ripple-demo.html', styleUrls: ['ripple-demo.scss'], }) export class RippleDemoComponent { @ViewChild(MatRipple, {static: true}) ripple: MatRipple; centered = false; disabled = false; unbounded = false; rounded = false; radius: number = null; rippleSpeed = 1; rippleColor = ''; disableButtonRipples = false; launchRipple(persistent = false) { if (this.ripple) { //this.ripple.launch(0, 0, { centered: true, persistent }); } } fadeOutAll() { if (this.ripple) { //this.ripple.fadeOutAll(); } } }
liuy97/material-seed
src/app/material-demo/ripple/ripple-demo.ts
TypeScript
MethodDeclaration
launchRipple(persistent = false) { if (this.ripple) { //this.ripple.launch(0, 0, { centered: true, persistent }); } }
liuy97/material-seed
src/app/material-demo/ripple/ripple-demo.ts
TypeScript
MethodDeclaration
fadeOutAll() { if (this.ripple) { //this.ripple.fadeOutAll(); } }
liuy97/material-seed
src/app/material-demo/ripple/ripple-demo.ts
TypeScript
ArrowFunction
() => { assert.step('foo-bar owner called'); }
KrishnaRPatel/glimmer-vm
packages/@glimmer/integration-tests/test/owner-test.ts
TypeScript
ArrowFunction
() => { assert.step('foo-baz owner called'); }
KrishnaRPatel/glimmer-vm
packages/@glimmer/integration-tests/test/owner-test.ts
TypeScript
ClassDeclaration
class OwnerJitRuntimeResolver extends TestJitRuntimeResolver { lookupComponent(name: string, owner: () => void): ComponentDefinition | null { if (typeof owner === 'function') owner(); return super.lookupComponent(name, owner); } lookupCompileTimeComponent(name: string, owner: () => void): CompileTimeComponent | null { if (typeof owner === 'function') owner(); return super.lookupCompileTimeComponent(name, owner); } }
KrishnaRPatel/glimmer-vm
packages/@glimmer/integration-tests/test/owner-test.ts
TypeScript
ClassDeclaration
class OwnerJitRenderDelegate extends JitRenderDelegate { protected resolver = new OwnerJitRuntimeResolver(this.registry); }
KrishnaRPatel/glimmer-vm
packages/@glimmer/integration-tests/test/owner-test.ts
TypeScript
ClassDeclaration
class OwnerTest extends RenderTest { static suiteName = '[owner]'; declare delegate: OwnerJitRenderDelegate; @test 'owner can be used per-template in compile time resolver'(assert: Assert) { class FooBar extends EmberishCurlyComponent { layout = createTemplate('<FooBaz/>')(() => { assert.step('foo-bar owner called'); }); } class FooBaz extends EmberishCurlyComponent { layout = createTemplate('<FooQux/>')(() => { assert.step('foo-baz owner called'); }); } this.delegate.registerComponent('Curly', 'Curly', 'FooBar', null, FooBar); this.delegate.registerComponent('Curly', 'Curly', 'FooBaz', null, FooBaz); this.delegate.registerComponent('TemplateOnly', 'TemplateOnly', 'FooQux', 'testing'); this.render('<FooBar/>'); assert.verifySteps(['foo-bar owner called', 'foo-baz owner called'], 'owners used correctly'); } @test 'owner can be used per-template in runtime resolver'(assert: Assert) { class FooBar extends EmberishCurlyComponent { subcomponent = 'foo-baz'; layout = createTemplate('{{component this.subcomponent}}')(() => { assert.step('foo-bar owner called'); }); } class FooBaz extends EmberishCurlyComponent { subcomponent = 'foo-qux'; layout = createTemplate('{{component this.subcomponent}}')(() => { assert.step('foo-baz owner called'); }); } this.delegate.registerComponent('Curly', 'Curly', 'FooBar', null, FooBar); this.delegate.registerComponent('Curly', 'Curly', 'foo-baz', null, FooBaz); this.delegate.registerComponent('TemplateOnly', 'TemplateOnly', 'foo-qux', 'testing'); this.render('<FooBar/>'); assert.verifySteps(['foo-bar owner called', 'foo-baz owner called'], 'owners used correctly'); } }
KrishnaRPatel/glimmer-vm
packages/@glimmer/integration-tests/test/owner-test.ts
TypeScript
ClassDeclaration
class FooBar extends EmberishCurlyComponent { layout = createTemplate('<FooBaz/>')(() => { assert.step('foo-bar owner called'); }); }
KrishnaRPatel/glimmer-vm
packages/@glimmer/integration-tests/test/owner-test.ts
TypeScript
ClassDeclaration
class FooBaz extends EmberishCurlyComponent { layout = createTemplate('<FooQux/>')(() => { assert.step('foo-baz owner called'); }); }
KrishnaRPatel/glimmer-vm
packages/@glimmer/integration-tests/test/owner-test.ts
TypeScript
ClassDeclaration
class FooBar extends EmberishCurlyComponent { subcomponent = 'foo-baz'; layout = createTemplate('{{component this.subcomponent}}')(() => { assert.step('foo-bar owner called'); }); }
KrishnaRPatel/glimmer-vm
packages/@glimmer/integration-tests/test/owner-test.ts
TypeScript
ClassDeclaration
class FooBaz extends EmberishCurlyComponent { subcomponent = 'foo-qux'; layout = createTemplate('{{component this.subcomponent}}')(() => { assert.step('foo-baz owner called'); }); }
KrishnaRPatel/glimmer-vm
packages/@glimmer/integration-tests/test/owner-test.ts
TypeScript
MethodDeclaration
lookupComponent(name: string, owner: () => void): ComponentDefinition | null { if (typeof owner === 'function') owner(); return super.lookupComponent(name, owner); }
KrishnaRPatel/glimmer-vm
packages/@glimmer/integration-tests/test/owner-test.ts
TypeScript
MethodDeclaration
lookupCompileTimeComponent(name: string, owner: () => void): CompileTimeComponent | null { if (typeof owner === 'function') owner(); return super.lookupCompileTimeComponent(name, owner); }
KrishnaRPatel/glimmer-vm
packages/@glimmer/integration-tests/test/owner-test.ts
TypeScript
MethodDeclaration
@test 'owner can be used per-template in compile time resolver'(assert: Assert) { class FooBar extends EmberishCurlyComponent { layout = createTemplate('<FooBaz/>')(() => { assert.step('foo-bar owner called'); }); } class FooBaz extends EmberishCurlyComponent { layout = createTemplate('<FooQux/>')(() => { assert.step('foo-baz owner called'); }); } this.delegate.registerComponent('Curly', 'Curly', 'FooBar', null, FooBar); this.delegate.registerComponent('Curly', 'Curly', 'FooBaz', null, FooBaz); this.delegate.registerComponent('TemplateOnly', 'TemplateOnly', 'FooQux', 'testing'); this.render('<FooBar/>'); assert.verifySteps(['foo-bar owner called', 'foo-baz owner called'], 'owners used correctly'); }
KrishnaRPatel/glimmer-vm
packages/@glimmer/integration-tests/test/owner-test.ts
TypeScript
MethodDeclaration
@test 'owner can be used per-template in runtime resolver'(assert: Assert) { class FooBar extends EmberishCurlyComponent { subcomponent = 'foo-baz'; layout = createTemplate('{{component this.subcomponent}}')(() => { assert.step('foo-bar owner called'); }); } class FooBaz extends EmberishCurlyComponent { subcomponent = 'foo-qux'; layout = createTemplate('{{component this.subcomponent}}')(() => { assert.step('foo-baz owner called'); }); } this.delegate.registerComponent('Curly', 'Curly', 'FooBar', null, FooBar); this.delegate.registerComponent('Curly', 'Curly', 'foo-baz', null, FooBaz); this.delegate.registerComponent('TemplateOnly', 'TemplateOnly', 'foo-qux', 'testing'); this.render('<FooBar/>'); assert.verifySteps(['foo-bar owner called', 'foo-baz owner called'], 'owners used correctly'); }
KrishnaRPatel/glimmer-vm
packages/@glimmer/integration-tests/test/owner-test.ts
TypeScript
ClassDeclaration
/** * Represents a {@link https://www.terraform.io/docs/providers/aws/r/vpc_ipam_pool_cidr_allocation aws_vpc_ipam_pool_cidr_allocation} */ export class VpcIpamPoolCidrAllocation extends cdktf.TerraformResource { // ================= // STATIC PROPERTIES // ================= public static readonly tfResourceType: string = "aws_vpc_ipam_pool_cidr_allocation"; // =========== // INITIALIZER // =========== /** * Create a new {@link https://www.terraform.io/docs/providers/aws/r/vpc_ipam_pool_cidr_allocation aws_vpc_ipam_pool_cidr_allocation} Resource * * @param scope The scope in which to define this construct * @param id The scoped construct ID. Must be unique amongst siblings in the same scope * @param options VpcIpamPoolCidrAllocationConfig */ public constructor(scope: Construct, id: string, config: VpcIpamPoolCidrAllocationConfig) { super(scope, id, { terraformResourceType: 'aws_vpc_ipam_pool_cidr_allocation', terraformGeneratorMetadata: { providerName: 'aws' }, provider: config.provider, dependsOn: config.dependsOn, count: config.count, lifecycle: config.lifecycle }); this._cidr = config.cidr; this._description = config.description; this._disallowedCidrs = config.disallowedCidrs; this._ipamPoolId = config.ipamPoolId; this._netmaskLength = config.netmaskLength; } // ========== // ATTRIBUTES // ========== // cidr - computed: true, optional: true, required: false private _cidr?: string; public get cidr() { return this.getStringAttribute('cidr'); } public set cidr(value: string) { this._cidr = value; } public resetCidr() { this._cidr = undefined; } // Temporarily expose input value. Use with caution. public get cidrInput() { return this._cidr; } // description - computed: false, optional: true, required: false private _description?: string; public get description() { return this.getStringAttribute('description'); } public set description(value: string) { this._description = value; } public resetDescription() { this._description = undefined; } // Temporarily expose input value. Use with caution. public get descriptionInput() { return this._description; } // disallowed_cidrs - computed: false, optional: true, required: false private _disallowedCidrs?: string[]; public get disallowedCidrs() { return this.getListAttribute('disallowed_cidrs'); } public set disallowedCidrs(value: string[]) { this._disallowedCidrs = value; } public resetDisallowedCidrs() { this._disallowedCidrs = undefined; } // Temporarily expose input value. Use with caution. public get disallowedCidrsInput() { return this._disallowedCidrs; } // id - computed: true, optional: true, required: false public get id() { return this.getStringAttribute('id'); } // ipam_pool_allocation_id - computed: true, optional: false, required: false public get ipamPoolAllocationId() { return this.getStringAttribute('ipam_pool_allocation_id'); } // ipam_pool_id - computed: false, optional: false, required: true private _ipamPoolId?: string; public get ipamPoolId() { return this.getStringAttribute('ipam_pool_id'); } public set ipamPoolId(value: string) { this._ipamPoolId = value; } // Temporarily expose input value. Use with caution. public get ipamPoolIdInput() { return this._ipamPoolId; } // netmask_length - computed: false, optional: true, required: false private _netmaskLength?: number; public get netmaskLength() { return this.getNumberAttribute('netmask_length'); } public set netmaskLength(value: number) { this._netmaskLength = value; } public resetNetmaskLength() { this._netmaskLength = undefined; } // Temporarily expose input value. Use with caution. public get netmaskLengthInput() { return this._netmaskLength; } // resource_id - computed: true, optional: false, required: false public get resourceId() { return this.getStringAttribute('resource_id'); } // resource_owner - computed: true, optional: false, required: false public get resourceOwner() { return this.getStringAttribute('resource_owner'); } // resource_type - computed: true, optional: false, required: false public get resourceType() { return this.getStringAttribute('resource_type'); } // ========= // SYNTHESIS // ========= protected synthesizeAttributes(): { [name: string]: any } { return { cidr: cdktf.stringToTerraform(this._cidr), description: cdktf.stringToTerraform(this._description), disallowed_cidrs: cdktf.listMapper(cdktf.stringToTerraform)(this._disallowedCidrs), ipam_pool_id: cdktf.stringToTerraform(this._ipamPoolId), netmask_length: cdktf.numberToTerraform(this._netmaskLength), }; } }
hashicorp/cdktf-provider-aws
src/vpc/vpc-ipam-pool-cidr-allocation.ts
TypeScript
InterfaceDeclaration
/** * AWS VPC */ export interface VpcIpamPoolCidrAllocationConfig extends cdktf.TerraformMetaArguments { /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/vpc_ipam_pool_cidr_allocation#cidr VpcIpamPoolCidrAllocation#cidr} */ readonly cidr?: string; /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/vpc_ipam_pool_cidr_allocation#description VpcIpamPoolCidrAllocation#description} */ readonly description?: string; /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/vpc_ipam_pool_cidr_allocation#disallowed_cidrs VpcIpamPoolCidrAllocation#disallowed_cidrs} */ readonly disallowedCidrs?: string[]; /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/vpc_ipam_pool_cidr_allocation#ipam_pool_id VpcIpamPoolCidrAllocation#ipam_pool_id} */ readonly ipamPoolId: string; /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/vpc_ipam_pool_cidr_allocation#netmask_length VpcIpamPoolCidrAllocation#netmask_length} */ readonly netmaskLength?: number; }
hashicorp/cdktf-provider-aws
src/vpc/vpc-ipam-pool-cidr-allocation.ts
TypeScript
MethodDeclaration
public resetCidr() { this._cidr = undefined; }
hashicorp/cdktf-provider-aws
src/vpc/vpc-ipam-pool-cidr-allocation.ts
TypeScript
MethodDeclaration
public resetDescription() { this._description = undefined; }
hashicorp/cdktf-provider-aws
src/vpc/vpc-ipam-pool-cidr-allocation.ts
TypeScript
MethodDeclaration
public resetDisallowedCidrs() { this._disallowedCidrs = undefined; }
hashicorp/cdktf-provider-aws
src/vpc/vpc-ipam-pool-cidr-allocation.ts
TypeScript
MethodDeclaration
public resetNetmaskLength() { this._netmaskLength = undefined; }
hashicorp/cdktf-provider-aws
src/vpc/vpc-ipam-pool-cidr-allocation.ts
TypeScript
MethodDeclaration
// ========= // SYNTHESIS // ========= protected synthesizeAttributes(): { [name: string]: any } { return { cidr: cdktf.stringToTerraform(this._cidr), description: cdktf.stringToTerraform(this._description), disallowed_cidrs: cdktf.listMapper(cdktf.stringToTerraform)(this._disallowedCidrs), ipam_pool_id: cdktf.stringToTerraform(this._ipamPoolId), netmask_length: cdktf.numberToTerraform(this._netmaskLength), }; }
hashicorp/cdktf-provider-aws
src/vpc/vpc-ipam-pool-cidr-allocation.ts
TypeScript
ArrowFunction
(n) => `${n}`
polygonjs/polygonjs
src/engine/scene/utils/events/WindowEventsController.ts
TypeScript
ClassDeclaration
export class WindowEventsController extends BaseSceneEventsController<Event, PointerEventNode> { protected _require_canvas_event_listeners: boolean = true; type() { return 'window'; } acceptedEventTypes() { return ACCEPTED_WINDOW_EVENT_TYPES.map((n) => `${n}`); } }
polygonjs/polygonjs
src/engine/scene/utils/events/WindowEventsController.ts
TypeScript
EnumDeclaration
// https://developer.mozilla.org/en-US/docs/Web/Events enum WindowEventType { resize = 'resize', }
polygonjs/polygonjs
src/engine/scene/utils/events/WindowEventsController.ts
TypeScript
MethodDeclaration
type() { return 'window'; }
polygonjs/polygonjs
src/engine/scene/utils/events/WindowEventsController.ts
TypeScript
MethodDeclaration
acceptedEventTypes() { return ACCEPTED_WINDOW_EVENT_TYPES.map((n) => `${n}`); }
polygonjs/polygonjs
src/engine/scene/utils/events/WindowEventsController.ts
TypeScript
FunctionDeclaration
//装饰器 //类装饰器 //普通装饰器 /* function logClazz(params: any) { console.log(params); //params 就是当前类 params.prototype.apiUrl = "https://sogrey.top" } @logClazz class HttpClient { constructor() { } getData() { } } */ /* 输出了: ƒ HttpClient() { } */ /* var http = new HttpClient(); console.log(http.apiUrl)//https://sogrey.top */ // 装饰器工厂 /* function logClazz(params: string) { return function (target: any) { console.log(params); console.log(target);//此时的target就是当前类 target.prototype.apiUrl = params; } } @logClazz('https://sogrey.top/api') class HttpClient { constructor() { } getData() { } } */ /* 输出了: http ƒ HttpClient() { } */ /* var http = new HttpClient(); console.log(http.apiUrl)//https://sogrey.top/api */ //属性装饰器 /* //类装饰器 function logClazz(params: string) { return function (target: any) { console.log(params); console.log(target);//此时的target就是当前类 } } //属性装饰器 function logProterty(params: string){ return function(target:any,attr:any){ console.log(target); console.log(attr); target[attr] = params; } } @logClazz('/getUser') class HttpClient { @logProterty('https://sogrey.top/api') url:string|undefined; constructor() { } getData() { } } */ /* 运行输出: {getData: ƒ, constructor: ƒ} url /getUser ƒ HttpClient() { } */ /* var http = new HttpClient(); console.log(http.url);//https://sogrey.top/api */ //方法装饰器 /* function get(params: any) {//params 装饰器传入参数 return function (target: any, methodName: any, desc: any) { console.log(target);//当前类 console.log(methodName);//方法名 console.log(desc);//方法描述符 //扩展 target.url = "扩展的 URL"; target.run = function () { console.log("扩展的方法"); } //1. 保存当前方法 var oMethod = desc.value; desc.value = function (...args: any[]) { args = args.map((value) => { return String(value); }); console.log(args); oMethod.apply(this, args); } } } class HttpClient { url: string | undefined; constructor() { } @get('https://sogrey.top/api') getData(...args: any[]) { console.log(args); console.log("这是getData输出的"); } } */ /* {getData: ƒ, constructor: ƒ} getData {writable: true, enumerable: true, configurable: true, value: ƒ} */ /* var http = new HttpClient(); console.log(http.url);//扩展的 URL http.run();//扩展的 URL http.getData(123, "ABS");// ["123", "ABS"] */ //方法参数装饰器 /* function logParams(params: any) { return function (target: any, methodName: any, paramsIndex: any) { console.log(params);//装饰器传入参数 console.log(target);//当前类 console.log(methodName);//方法名 console.log(paramsIndex);//参数索引 //扩展属性 target.apiUrl = 'https://sogrey.top/api'; } } class HttpClient { url: string | undefined; constructor() { } getData(@logParams('uuid') uuid:any) { console.log(uuid); } } var http= new HttpClient(); http.getData(123456); */ /* uuid {getData: ƒ, constructor: ƒ} getData 0 123456 */ /* console.log(http.apiUrl)//https://sogrey.top/api */ //装饰器执行顺序 //类装饰器 function logClazz1(params: any) { return function (target: any) { console.log("类装饰器1"); } }
Sogrey/TypeScript-start
examples/09-Decorator/09-Decorator.ts
TypeScript
FunctionDeclaration
function logClazz2(params: any) { return function (target: any) { console.log("类装饰器2"); } }
Sogrey/TypeScript-start
examples/09-Decorator/09-Decorator.ts
TypeScript
FunctionDeclaration
//属性装饰器 function logAttr(params?: string) { return function (target: any, attrName: any) { console.log("属性装饰器"); } }
Sogrey/TypeScript-start
examples/09-Decorator/09-Decorator.ts
TypeScript
FunctionDeclaration
//方法装饰器 function logMethod(params?: string) { return function (target: any, methodName: any, desc: any) { console.log("方法装饰器"); } }
Sogrey/TypeScript-start
examples/09-Decorator/09-Decorator.ts
TypeScript
FunctionDeclaration
//参数装饰器 function logParams1(params?: string) { return function (target: any, methodName: any, desc: any) { console.log("参数装饰器1"); } }
Sogrey/TypeScript-start
examples/09-Decorator/09-Decorator.ts
TypeScript
FunctionDeclaration
function logParams2(params?: string) { return function (target: any, methodName: any, desc: any) { console.log("参数装饰器2"); } }
Sogrey/TypeScript-start
examples/09-Decorator/09-Decorator.ts
TypeScript
ClassDeclaration
@logClazz1('类装饰器') @logClazz2('类装饰器') class HttpClient { @logAttr() url: string | undefined; constructor() { } @logMethod() getData() { console.log("getData"); } setData(@logParams1() attr1:any,@logParams2() attr2:any){ } }
Sogrey/TypeScript-start
examples/09-Decorator/09-Decorator.ts
TypeScript
MethodDeclaration
@logMethod() getData() { console.log("getData"); }
Sogrey/TypeScript-start
examples/09-Decorator/09-Decorator.ts
TypeScript
MethodDeclaration
setData(@logParams1() attr1:any,@logParams2() attr2:any){ }
Sogrey/TypeScript-start
examples/09-Decorator/09-Decorator.ts
TypeScript
ClassDeclaration
export default class MdExplore extends React.Component<IconBaseProps> { }
0916dhkim/DefinitelyTyped
types/react-icons/md/explore.d.ts
TypeScript
ArrowFunction
(förval: systemets språk)
nixoncoin/nixoncoin
src/qt/locale/bitcoin_sv.ts
TypeScript
ArrowFunction
(standard: 7765 eller testnät: 17765)
nixoncoin/nixoncoin
src/qt/locale/bitcoin_sv.ts
TypeScript
ArrowFunction
(standard: 7766 eller testnät: 17766)
nixoncoin/nixoncoin
src/qt/locale/bitcoin_sv.ts
TypeScript
ArrowFunction
props => { const { value, format, autoOk, openTo, minDate, maxDate, initialFocusedDate, showTabs, autoSubmit, disablePast, disableFuture, leftArrowIcon, rightArrowIcon, dateRangeIcon, timeIcon, renderDay, ampm, shouldDisableDate, animateYearScrolling, forwardedRef, allowKeyboardControl, ...other } = props; return ( <BasePicker {...props} autoOk> {({ date, utils, handleChange, handleTextFieldChange, isAccepted, pick12hOr24hFormat, handleAccept, })
jetbridge/material-ui-pickers
src/DateTimePicker/DateTimePickerInline.tsx
TypeScript
ArrowFunction
(props: DateTimePickerInlineProps, ref) => ( <DateTimePickerInline {...props}
jetbridge/material-ui-pickers
src/DateTimePicker/DateTimePickerInline.tsx
TypeScript
InterfaceDeclaration
export interface DateTimePickerInlineProps extends BasePickerProps, BaseDateTimePickerProps, Omit<OuterInlineWrapperProps, 'onChange' | 'value'> {}
jetbridge/material-ui-pickers
src/DateTimePicker/DateTimePickerInline.tsx
TypeScript
MethodDeclaration
pick12hOr24hFormat( utils
jetbridge/material-ui-pickers
src/DateTimePicker/DateTimePickerInline.tsx
TypeScript
ClassDeclaration
@Component({ selector: 'app-visit-history', templateUrl: './visit-history.page.html', styleUrls: ['./visit-history.page.scss'], }) export class VisitHistoryPage implements OnInit { constructor() { } ngOnInit() { } }
pratiklokhande/quarantine
quarantine/src/app/pages/visit-history/visit-history.page.ts
TypeScript
ClassDeclaration
export class WarpManager<M extends Model = Model> extends ModelManager<M> { constructor(client: WarpClient) { super(); Object.defineProperty(this, "client", { value: client, enumerable: true, configurable: true, }); } readonly client!: WarpClient; override readonly modelManagerObservers!: ReadonlyArray<WarpManagerObserver>; @Lazy static global<M extends Model>(): WarpManager<M> { return new WarpManager(client); } }
asad-awadia/swim
swim-toolkit-js/swim-ui-js/@swim/model/main/warp/WarpManager.ts
TypeScript
MethodDeclaration
@Lazy static global<M extends Model>(): WarpManager<M> { return new WarpManager(client); }
asad-awadia/swim
swim-toolkit-js/swim-ui-js/@swim/model/main/warp/WarpManager.ts
TypeScript
ClassDeclaration
export class MultipleCurrentsError { currentResidency: Residency; conflictPeriod: Period; constructor(currentResidency: Residency, conflictPeriod: Period) { this.currentResidency = currentResidency; this.conflictPeriod = conflictPeriod; } }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
ClassDeclaration
export class ConflictInPeriodsError { conflictResidency: Residency; conflictPeriod: Period; constructor(conflictResidency: Residency, conflictPeriod: Period) { this.conflictResidency = conflictResidency; this.conflictPeriod = conflictPeriod; } }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
ClassDeclaration
export default class Residency { private id: string; private city: City; private fromDate: ShortDate; private toDate: ShortDate | null; static findResidencyDuring( residencies: Residency[], period: Period ): Residency | null { return Residency.findResidencyDuringWithBinarySearch( residencies, 0, residencies.length - 1, period ); } private static findResidencyDuringWithBinarySearch( residencies: Residency[], lo: number, hi: number, period: Period ): Residency | null { if (hi < lo) return null; const mi = lo + Math.floor((hi - lo) / 2); const mid = residencies[mi]; if (mid.containsPeriod(period)) { return mid; } if (period.isBefore(mid.getPeriod())) { const leftResult = Residency.findResidencyDuringWithBinarySearch( residencies, lo, mi - 1, period ); if (leftResult !== null) return leftResult; } else { const rightResult = Residency.findResidencyDuringWithBinarySearch( residencies, mi + 1, hi, period ); if (rightResult !== null) return rightResult; } return null; } static findResidencyAt( residencies: Residency[], date: ShortDate ): Residency | null { return Residency.findResidencyWithBinarySearch( residencies, 0, residencies.length - 1, date ); } private static findResidencyWithBinarySearch( residencies: Residency[], lo: number, hi: number, date: ShortDate ): Residency | null { if (hi < lo) return null; const mi = lo + Math.floor((hi - lo) / 2); const mid = residencies[mi]; if (mid.containsDate(date)) { return mid; } if (date.isBefore(mid.getFromDate())) { const leftResult = Residency.findResidencyWithBinarySearch( residencies, lo, mi - 1, date ); if (leftResult !== null) return leftResult; } else { const rightResult = Residency.findResidencyWithBinarySearch( residencies, mi + 1, hi, date ); if (rightResult !== null) return rightResult; } return null; } /** * Determines whether the properties of the new residency candidate is consistent * with the existing Residency objects. * @param existingResidencies Must be sorted. * @throws `MultipleCurrentsError` * @throws `ConflictInPeriodsError` */ static validateConsistency( residencies: Residency[], { id, city, fromDate, toDate }: ResidencyCandidate ): void { const N = residencies.length; if (N === 0) return; const candidateRsd = new Residency(id, city, fromDate, toDate); const lastRsd = residencies[N - 1]; if ( lastRsd.isOngoing() && candidateRsd.isOngoing() && candidateRsd.getID() !== lastRsd.getID() ) throw new MultipleCurrentsError( lastRsd, lastRsd.getConflictPeriodWith(candidateRsd) ); Residency.validateWithBinarySearch(residencies, 0, N - 1, candidateRsd); } private static validateWithBinarySearch( residencies: Residency[], lo: number, hi: number, candidate: Residency ): void { if (hi < lo) return; const mi = lo + Math.floor((hi - lo) / 2); const mid = residencies[mi]; if (mid.getID() !== candidate.getID()) { const conflictPeriod = mid.getConflictPeriodWith(candidate); if (conflictPeriod !== null) throw new ConflictInPeriodsError(mid, conflictPeriod); } if (candidate.getFromDate().isBefore(mid.getFromDate())) Residency.validateWithBinarySearch(residencies, lo, mi - 1, candidate); else Residency.validateWithBinarySearch(residencies, mi + 1, hi, candidate); } static comparator(rsd1: Residency, rsd2: Residency) { return rsd1.getFromDate().compareTo(rsd2.getFromDate()); } static createWithRawParams( id: string, cityCode: string, fromDateString: string, toDateString: string | null ) { const city = new City(cityCode); const fromDate = ShortDate.createWithYMDString(fromDateString); const toDate = toDateString ? ShortDate.createWithYMDString(toDateString) : null; return new Residency(id, city, fromDate, toDate); } constructor( id: string | undefined, city: City, fromDate: ShortDate, toDate: ShortDate | null ) { this.id = id; this.city = city; this.fromDate = fromDate; this.toDate = toDate; } conflictsWith(that: Residency) { return this.getConflictPeriodWith(that) !== null; } /** @returns null if there is no conflict, the period of conflict otherwise */ getConflictPeriodWith(that: Residency): Period | null { if (this.isOngoing() && that.isOngoing()) { const later = ShortDate.max(this.getFromDate(), that.getFromDate()); return new Period(later, ShortDate.createCurrent()); } return this.getPeriod().intersection(that.getPeriod()); } getID(): string { return this.id; } getFromDate(): ShortDate { return this.fromDate; } getToDate(): ShortDate | null { return this.toDate; } getPeriod(): Period { return new Period(this.fromDate, this.currentToDate()); } getDuration(): number { return this.currentToDate().diff(this.fromDate); } containsDate(date: ShortDate): boolean { return this.getPeriod().contains(date); } containsPeriod(thatPeriod: Period): boolean { return this.getPeriod().containsPeriod(thatPeriod); } private currentToDate(): ShortDate { return this.isOngoing() ? ShortDate.createCurrent() : this.toDate; } isOngoing(): boolean { return this.toDate === null; } getCity(): City { return this.city; } describePeriod(): string { const from = this.fromDate.asShortMonthAndYear(); const to = this.toDate === null ? 'Current' : this.toDate.asShortMonthAndYear(); return `${from} - ${to}`; } equals(that: Residency): boolean { let toDatesAreEqual = false; toDatesAreEqual = this.toDate === null ? that.toDate === null : this.toDate.equals(that.toDate); return ( this.id === that.id && this.city.equals(that.city) && this.fromDate.equals(that.fromDate) && toDatesAreEqual ); } }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
InterfaceDeclaration
export interface ResidencyCandidate { id?: string; city: City; fromDate: ShortDate; toDate: ShortDate | null; }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
static findResidencyDuring( residencies: Residency[], period: Period ): Residency | null { return Residency.findResidencyDuringWithBinarySearch( residencies, 0, residencies.length - 1, period ); }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
private static findResidencyDuringWithBinarySearch( residencies: Residency[], lo: number, hi: number, period: Period ): Residency | null { if (hi < lo) return null; const mi = lo + Math.floor((hi - lo) / 2); const mid = residencies[mi]; if (mid.containsPeriod(period)) { return mid; } if (period.isBefore(mid.getPeriod())) { const leftResult = Residency.findResidencyDuringWithBinarySearch( residencies, lo, mi - 1, period ); if (leftResult !== null) return leftResult; } else { const rightResult = Residency.findResidencyDuringWithBinarySearch( residencies, mi + 1, hi, period ); if (rightResult !== null) return rightResult; } return null; }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
static findResidencyAt( residencies: Residency[], date: ShortDate ): Residency | null { return Residency.findResidencyWithBinarySearch( residencies, 0, residencies.length - 1, date ); }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
private static findResidencyWithBinarySearch( residencies: Residency[], lo: number, hi: number, date: ShortDate ): Residency | null { if (hi < lo) return null; const mi = lo + Math.floor((hi - lo) / 2); const mid = residencies[mi]; if (mid.containsDate(date)) { return mid; } if (date.isBefore(mid.getFromDate())) { const leftResult = Residency.findResidencyWithBinarySearch( residencies, lo, mi - 1, date ); if (leftResult !== null) return leftResult; } else { const rightResult = Residency.findResidencyWithBinarySearch( residencies, mi + 1, hi, date ); if (rightResult !== null) return rightResult; } return null; }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
/** * Determines whether the properties of the new residency candidate is consistent * with the existing Residency objects. * @param existingResidencies Must be sorted. * @throws `MultipleCurrentsError` * @throws `ConflictInPeriodsError` */ static validateConsistency( residencies: Residency[], { id, city, fromDate, toDate }: ResidencyCandidate ): void { const N = residencies.length; if (N === 0) return; const candidateRsd = new Residency(id, city, fromDate, toDate); const lastRsd = residencies[N - 1]; if ( lastRsd.isOngoing() && candidateRsd.isOngoing() && candidateRsd.getID() !== lastRsd.getID() ) throw new MultipleCurrentsError( lastRsd, lastRsd.getConflictPeriodWith(candidateRsd) ); Residency.validateWithBinarySearch(residencies, 0, N - 1, candidateRsd); }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
private static validateWithBinarySearch( residencies: Residency[], lo: number, hi: number, candidate: Residency ): void { if (hi < lo) return; const mi = lo + Math.floor((hi - lo) / 2); const mid = residencies[mi]; if (mid.getID() !== candidate.getID()) { const conflictPeriod = mid.getConflictPeriodWith(candidate); if (conflictPeriod !== null) throw new ConflictInPeriodsError(mid, conflictPeriod); } if (candidate.getFromDate().isBefore(mid.getFromDate())) Residency.validateWithBinarySearch(residencies, lo, mi - 1, candidate); else Residency.validateWithBinarySearch(residencies, mi + 1, hi, candidate); }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
static comparator(rsd1: Residency, rsd2: Residency) { return rsd1.getFromDate().compareTo(rsd2.getFromDate()); }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
static createWithRawParams( id: string, cityCode: string, fromDateString: string, toDateString: string | null ) { const city = new City(cityCode); const fromDate = ShortDate.createWithYMDString(fromDateString); const toDate = toDateString ? ShortDate.createWithYMDString(toDateString) : null; return new Residency(id, city, fromDate, toDate); }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
conflictsWith(that: Residency) { return this.getConflictPeriodWith(that) !== null; }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
/** @returns null if there is no conflict, the period of conflict otherwise */ getConflictPeriodWith(that: Residency): Period | null { if (this.isOngoing() && that.isOngoing()) { const later = ShortDate.max(this.getFromDate(), that.getFromDate()); return new Period(later, ShortDate.createCurrent()); } return this.getPeriod().intersection(that.getPeriod()); }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
getID(): string { return this.id; }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
getFromDate(): ShortDate { return this.fromDate; }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
getToDate(): ShortDate | null { return this.toDate; }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
getPeriod(): Period { return new Period(this.fromDate, this.currentToDate()); }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
getDuration(): number { return this.currentToDate().diff(this.fromDate); }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
containsDate(date: ShortDate): boolean { return this.getPeriod().contains(date); }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
containsPeriod(thatPeriod: Period): boolean { return this.getPeriod().containsPeriod(thatPeriod); }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
private currentToDate(): ShortDate { return this.isOngoing() ? ShortDate.createCurrent() : this.toDate; }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
isOngoing(): boolean { return this.toDate === null; }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
getCity(): City { return this.city; }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
describePeriod(): string { const from = this.fromDate.asShortMonthAndYear(); const to = this.toDate === null ? 'Current' : this.toDate.asShortMonthAndYear(); return `${from} - ${to}`; }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
MethodDeclaration
equals(that: Residency): boolean { let toDatesAreEqual = false; toDatesAreEqual = this.toDate === null ? that.toDate === null : this.toDate.equals(that.toDate); return ( this.id === that.id && this.city.equals(that.city) && this.fromDate.equals(that.fromDate) && toDatesAreEqual ); }
anarkafkas/tripstack
data-types/Residency.ts
TypeScript
ArrowFunction
(searchTerm: string, handleSubmit: Function) => { const [value, setValue] = useState<string>(searchTerm); const handleChange = (event: any): void => { setValue(event.target.value); } const handleKeyDown = (event: KeyboardEvent): void => { if(event.code !== ENTER_CODE || !value) { return; } handleSubmit(value); } const handleEnter = (): void => { if(!value) { return; } handleSubmit(value); } return { value, handleChange, handleKeyDown, handleEnter } }
Kiep13/BookFund-v.2
apps/webapp/src/app/pages/base/Search/components/SearchInput/useSearchInput.ts
TypeScript
ArrowFunction
(event: any): void => { setValue(event.target.value); }
Kiep13/BookFund-v.2
apps/webapp/src/app/pages/base/Search/components/SearchInput/useSearchInput.ts
TypeScript
ArrowFunction
(event: KeyboardEvent): void => { if(event.code !== ENTER_CODE || !value) { return; } handleSubmit(value); }
Kiep13/BookFund-v.2
apps/webapp/src/app/pages/base/Search/components/SearchInput/useSearchInput.ts
TypeScript
ArrowFunction
(): void => { if(!value) { return; } handleSubmit(value); }
Kiep13/BookFund-v.2
apps/webapp/src/app/pages/base/Search/components/SearchInput/useSearchInput.ts
TypeScript
ArrowFunction
({ device, closeModal }) => ( <Modal shouldShow> <ModalWrapper> <MainTitle>Install
steve-noel/ReactiveTraderCloud
src/client/src/apps/MainRoute/components/app-header/PWAInstallPrompt/PWAInstallModal.tsx
TypeScript
InterfaceDeclaration
interface InstallModalProps { device: MobileDevice | null closeModal: () => void }
steve-noel/ReactiveTraderCloud
src/client/src/apps/MainRoute/components/app-header/PWAInstallPrompt/PWAInstallModal.tsx
TypeScript
FunctionDeclaration
export function Content( { selectedGenreId, selectedGenre }: ContentProps ) { const [movies, setMovies] = useState<MovieProps[]>([]); useEffect(() => { api.get<MovieProps[]>(`movies/?Genre_id=${selectedGenreId}`).then(response => { setMovies(response.data); }); }, [selectedGenreId]); return( <div className="container"> <header> <span className="category">Categoria:<span> {selectedGenre.title}</span></span> </header> <main> <div className="movies-list"> {movies.map(movie => ( <MovieCard key ={movie.imdbID} title={movie.Title} poster={movie.Poster} runtime={movie.Runtime} rating={movie.Ratings[0].Value} /> ))} </div> </main> </div> ) }
ThallesLana/desafio-reactjs-02
src/components/Content.tsx
TypeScript
InterfaceDeclaration
interface ContentProps { selectedGenreId: number; selectedGenre: GenreResponseProps; }
ThallesLana/desafio-reactjs-02
src/components/Content.tsx
TypeScript
InterfaceDeclaration
export interface GluegunPatching { /** * Checks if a string or pattern exists in a file. */ exists(filename: string, findPattern: string | RegExp): Promise<boolean>; /** * Updates a file. */ update(filename: string, callback: (contents: any) => any): Promise<string | object | boolean>; /** * Appends to the end of a file. */ append(filename: string, contents: string): Promise<string | boolean>; /** * Prepends to the start of a files. */ prepend(filename: string, contents: string): Promise<string | boolean>; /** * Replaces part of a file. */ replace(filename: string, searchFor: string, replaceWith: string): Promise<string | boolean>; /** * Makes a patch inside file. */ patch(filename: string, options: GluegunPatchingPatchOptions): Promise<string | boolean>; }
AndonMitev/SubGraph
node_modules/gluegun/build/types/toolbox/patching-types.d.ts
TypeScript
InterfaceDeclaration
export interface GluegunPatchingPatchOptions { insert?: string; before?: string | RegExp; after?: string | RegExp; replace?: string | RegExp; delete?: string | RegExp; force?: boolean; }
AndonMitev/SubGraph
node_modules/gluegun/build/types/toolbox/patching-types.d.ts
TypeScript
FunctionDeclaration
export function LoginBox() { const { signInUrl } = useContext(AuthContext); return ( <div className={styles.loginBoxWrapper}> <strong>Entre e compartile sua mensagem</strong> <a href={signInUrl} className={styles.signInWithGithub}> <VscGithubInverted size="24" /> Entrar com Github </a> </div> ); }
VitorFirmino/NLW-7
web/src/components/LoginBox/index.tsx
TypeScript
ArrowFunction
() => { logger.info(`Server Running on ${port}`); }
jun-jungin-web-study/DiarySNS-Server
src/app.ts
TypeScript
ArrowFunction
(req, res) => res.status(200).send("Hello")
jun-jungin-web-study/DiarySNS-Server
src/app.ts
TypeScript
ArrowFunction
controller => { this.app.use(controller.url, controller.router); }
jun-jungin-web-study/DiarySNS-Server
src/app.ts
TypeScript
ArrowFunction
(err: Error, req: Request, res: Response, next: NextFunction) => { res.status(442).json({ error: { message: err } }); }
jun-jungin-web-study/DiarySNS-Server
src/app.ts
TypeScript
ArrowFunction
middleware => this.app.use(middleware)
jun-jungin-web-study/DiarySNS-Server
src/app.ts
TypeScript
ClassDeclaration
class App { public app: express.Application; constructor(controllers: baseController[], middlewares: any[]) { const app = express(); this.app = app; this.registerMiddlewares(middlewares); this.registerControllers(controllers); } public listen(port: number): Server { return this.app.listen(port, () => { logger.info(`Server Running on ${port}`); }); } private registerControllers(controllers: baseController[]): void { this.app.get("/", (req, res) => res.status(200).send("Hello")); controllers.forEach(controller => { this.app.use(controller.url, controller.router); }); this.app.use((err: Error, req: Request, res: Response, next: NextFunction) => { res.status(442).json({ error: { message: err } }); }); } private registerMiddlewares(middlewares: any[]): void { middlewares.forEach(middleware => this.app.use(middleware)); } }
jun-jungin-web-study/DiarySNS-Server
src/app.ts
TypeScript
MethodDeclaration
public listen(port: number): Server { return this.app.listen(port, () => { logger.info(`Server Running on ${port}`); }); }
jun-jungin-web-study/DiarySNS-Server
src/app.ts
TypeScript
MethodDeclaration
private registerControllers(controllers: baseController[]): void { this.app.get("/", (req, res) => res.status(200).send("Hello")); controllers.forEach(controller => { this.app.use(controller.url, controller.router); }); this.app.use((err: Error, req: Request, res: Response, next: NextFunction) => { res.status(442).json({ error: { message: err } }); }); }
jun-jungin-web-study/DiarySNS-Server
src/app.ts
TypeScript
MethodDeclaration
private registerMiddlewares(middlewares: any[]): void { middlewares.forEach(middleware => this.app.use(middleware)); }
jun-jungin-web-study/DiarySNS-Server
src/app.ts
TypeScript
ClassDeclaration
@Module({ imports: [], providers: [ViewService], controllers: [ViewController], }) export class ViewModule implements NestModule { configure(userContext: MiddlewareConsumer): void { userContext.apply(NextMiddleware) // .forRoutes({path: 'bar', method: RequestMethod.PUT}) } }
Ajoe88/ajoe
server/src/view/view.module.ts
TypeScript
MethodDeclaration
configure(userContext: MiddlewareConsumer): void { userContext.apply(NextMiddleware) // .forRoutes({path: 'bar', method: RequestMethod.PUT}) }
Ajoe88/ajoe
server/src/view/view.module.ts
TypeScript
ClassDeclaration
/** * A stream marker, also containing some video data. */ export declare class HelixStreamMarkerWithVideo extends HelixStreamMarker { private readonly _videoId; /** @private */ readonly [rawDataSymbol]: HelixStreamMarkerVideoData; /** @private */ constructor(data: HelixStreamMarkerVideoData, _videoId: string, client: ApiClient); /** * The URL of the video, which will start playing at the position of the stream marker. */ get url(): string; /** * The ID of the video. */ get videoId(): string; /** * Retrieves the video data of the video the marker was set in. */ getVideo(): Promise<HelixVideo>; }
samerbam/twitch-timestamper
node_modules/@twurple/api/lib/api/helix/stream/HelixStreamMarkerWithVideo.d.ts
TypeScript
InterfaceDeclaration
/** @private */ export interface HelixStreamMarkerVideoData extends HelixStreamMarkerData { URL: string; }
samerbam/twitch-timestamper
node_modules/@twurple/api/lib/api/helix/stream/HelixStreamMarkerWithVideo.d.ts
TypeScript
MethodDeclaration
/** * Retrieves the video data of the video the marker was set in. */ getVideo(): Promise<HelixVideo>;
samerbam/twitch-timestamper
node_modules/@twurple/api/lib/api/helix/stream/HelixStreamMarkerWithVideo.d.ts
TypeScript
ArrowFunction
authData=>{ this.loading.dismiss().then(()=>{ this.navCtrl.setRoot(HomePage); }); }
fkurtulus/IonicFirebaseApp
src/pages/login/login.ts
TypeScript