type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
ArrowFunction |
(selectionId: SelectionId) => dotSelectionData.identity === selectionId | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
ArrowFunction |
(tooltipEvent: TooltipEvent) =>
(<DotPlotDataPoint>tooltipEvent.data).tooltipInfo | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
ClassDeclaration |
class VisualLayout {
private marginValue: IMargin;
private viewportValue: IViewport;
private viewportInValue: IViewport;
public defaultMargin: IMargin;
public defaultViewport: IViewport;
constructor(defaultViewport?: IViewport, defaultMargin?: IMargin) {
this.defaultViewport = defaultViewport || { width: 0, height: 0 };
this.defaultMargin = defaultMargin || { top: 0, bottom: 0, right: 0, left: 0 };
}
public get margin(): IMargin {
return this.marginValue || (this.margin = this.defaultMargin);
}
public set margin(value: IMargin) {
this.marginValue = VisualLayout.restrictToMinMax(value);
this.update();
}
public get viewport(): IViewport {
return this.viewportValue || (this.viewportValue = this.defaultViewport);
}
public set viewport(value: IViewport) {
this.viewportValue = VisualLayout.restrictToMinMax(value);
this.update();
}
public get viewportIn(): IViewport {
return this.viewportInValue || this.viewport;
}
public get viewportInIsZero(): boolean {
return this.viewportIn.width === 0 || this.viewportIn.height === 0;
}
private update(): void {
this.viewportInValue = VisualLayout.restrictToMinMax({
width: this.viewport.width - (this.margin.left + this.margin.right),
height: this.viewport.height - (this.margin.top + this.margin.bottom)
});
}
private static restrictToMinMax<T>(value: T): T {
var result = $.extend({}, value);
d3.keys(value).forEach(x => result[x] = Math.max(0, value[x]));
return result;
}
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
InterfaceDeclaration |
export interface DotPlotConstructorOptions {
animator?: IGenericAnimator;
svg?: D3.Selection;
margin?: IMargin;
radius?: number;
strokeWidth?: number;
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
InterfaceDeclaration |
export interface DotPlotDataPoint {
x: number;
y: number;
color?: string;
value?: number;
label?: string;
identity: SelectionId;
tooltipInfo?: TooltipDataItem[];
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
InterfaceDeclaration |
export interface DotPlotData {
dataPoints: DotPlotDataPoint[];
legendData: LegendData;
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
MethodDeclaration |
private update(): void {
this.viewportInValue = VisualLayout.restrictToMinMax({
width: this.viewport.width - (this.margin.left + this.margin.right),
height: this.viewport.height - (this.margin.top + this.margin.bottom)
});
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
MethodDeclaration |
private static restrictToMinMax<T>(value: T): T {
var result = $.extend({}, value);
d3.keys(value).forEach(x => result[x] = Math.max(0, value[x]));
return result;
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
MethodDeclaration |
private static round10(value: number, digits: number = 2) {
var scale = Math.pow(10, digits);
return (Math.round(scale * value) / scale);
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
MethodDeclaration |
private static getTooltipData(value: number): TooltipDataItem[] {
return [{
displayName: DotPlot.FrequencyText,
value: value.toString()
}];
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
MethodDeclaration |
public static converter(dataView: DataView, maxDots: number, colors: IDataColorPalette, host: IVisualHostServices): DotPlotData {
var dataPoints: DotPlotDataPoint[] = [];
var legendData: LegendData = {
dataPoints: [],
};
if (!dataView ||
!dataView.categorical ||
!dataView.categorical.values ||
dataView.categorical.values.length < 1 ||
!dataView.categorical ||
!dataView.categorical.categories ||
!dataView.categorical.categories[0]) {
return {
dataPoints: dataPoints,
legendData: legendData,
};
}
var catDv: DataViewCategorical = dataView.categorical;
var series: DataViewValueColumns = catDv.values;
var categoryColumn = catDv.categories[0];
var category: any[] = catDv.categories[0].values;
if (!series[0].source.type.integer) {
var visualMessage: IVisualErrorMessage = {
message: 'This visual expects integer Values. Try adding a text field to create a "Count of" value.',
title: 'Integer Value Expected',
detail: '',
};
var warning: IVisualWarning = {
code: 'UnexpectedValueType',
getMessages: () => visualMessage,
};
host.setWarnings([warning]);
return {
dataPoints: dataPoints,
legendData: legendData,
};
}
for (var i = 0, iLen = series.length; i < iLen; i++) {
var counts = {};
var values = series[i].values;
for (var j = 0, jLen = values.length; j < jLen; j++) {
var idx = category[j];
var value = values[j];
if (!counts[idx]) counts[idx] = 0;
counts[idx] += value;
}
var legendText = series[i].source.displayName;
var color = colors.getColorByIndex(i).value;
var data = d3.entries(counts);
var min = d3.min(data, d => d.value);
var max = d3.max(data, d => d.value);
var dotsScale: D3.Scale.LinearScale = d3.scale.linear().domain([min, max]);
if (max > maxDots) {
dotsScale.rangeRound([0, maxDots]);
var scale = DotPlot.round10(max / maxDots);
legendText += ` (1 dot = x${scale})`;
} else {
dotsScale.rangeRound([min, max]);
}
for (var k = 0, kLen = data.length; k < kLen; k++) {
var y = dotsScale(data[k].value);
var categorySelectionId = SelectionIdBuilder.builder()
.withCategory(categoryColumn, k)
.createSelectionId();
for (var level = 0; level < y; level++) {
dataPoints.push({
x: data[k].key,
y: level,
color: color,
identity: categorySelectionId,
tooltipInfo: DotPlot.getTooltipData(data[k].value)
});
}
}
legendData.dataPoints.push({
label: legendText,
color: color,
icon: LegendIcon.Box,
selected: false,
identity: null
});
}
return {
dataPoints: dataPoints,
legendData: legendData
};
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
MethodDeclaration |
public init(options: VisualInitOptions): void {
var element = options.element;
this.selectionManager = new SelectionManager({ hostServices: options.host });
this.hostService = options.host;
if (!this.svg) {
this.svg = d3.select(element.get(0)).append('svg');
}
if (!this.layout) {
this.layout = new VisualLayout(null, DotPlot.DefaultMargin);
}
if (!this.radius) {
this.radius = DotPlot.DefaultRadius;
}
if (!this.strokeWidth) {
this.strokeWidth = DotPlot.DefaultStrokeWidth;
}
this.svg.classed(DotPlot.VisualClassName, true);
this.colors = options.style.colorPalette.dataColors;
this.legend = createLegend(element, false, null);
this.dotPlot = this.svg
.append('g')
.classed(DotPlot.DotPlot.class, true);
this.axis = this.svg
.append('g')
.classed(DotPlot.Axis.class, true);
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
MethodDeclaration |
public update(options: VisualUpdateOptions): void {
if (!options.dataViews || !options.dataViews[0]) return;
this.durationAnimations = getAnimationDuration(this.animator, options.suppressAnimations);
var dataView = this.dataView = options.dataViews[0];
this.layout.viewport = options.viewport;
this.svg.style({
"height": this.layout.viewportIn.height,
"width": this.layout.viewportIn.width,
"left": this.layout.margin.left,
"right": this.layout.margin.right,
"position": "relative"
});
if (this.layout.viewportInIsZero) {
return;
}
var diameter: number = 2 * this.radius + 1;// "1" is to look better, because stroke width is not included in radius.
var dotsTotalHeight: number = this.layout.viewportIn.height - this.radius - DotPlot.MaxXAxisHeight;
var maxDots: number = Math.floor(dotsTotalHeight / diameter);
var data = DotPlot.converter(dataView, maxDots, this.colors, this.hostService);
var dataPoints = data.dataPoints;
var values = dataView.categorical
&& dataView.categorical.categories
&& dataView.categorical.categories.length > 0
? dataView.categorical.categories[0].values
: [];
var xValues = d3.set(values).values();
var xScale: D3.Scale.OrdinalScale = d3.scale.ordinal()
.domain(xValues)
.rangeBands([DotPlot.XAxisHorizontalMargin, this.layout.viewportIn.width - DotPlot.XAxisHorizontalMargin]);
var yScale: D3.Scale.LinearScale = d3.scale.linear()
.domain([0, maxDots])
.range([dotsTotalHeight, dotsTotalHeight - maxDots * diameter]);
// temporary disabled as this raises the following error on PBI Portal
// Uncaught TypeError: Cannot read property 'registerDirectivesForEndPoint' of undefined
//if(data.legendData.dataPoints.length > 0) {
// this.legend.drawLegend(data.legendData, viewport);
//}
this.drawAxis(xValues, xScale, this.layout.viewportIn.height - DotPlot.MaxXAxisHeight);
this.drawDotPlot(dataPoints, xScale, yScale);
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
MethodDeclaration |
private drawDotPlot(data: DotPlotDataPoint[], xScale: D3.Scale.OrdinalScale, yScale: D3.Scale.LinearScale): void {
var selection = this.dotPlot.selectAll(DotPlot.Dot.selector).data(data);
selection
.enter()
.append('circle')
.classed(DotPlot.Dot.class, true);
selection
.attr("cx", (point: DotPlotDataPoint) => xScale(point.x) + xScale.rangeBand() / 2)
.attr("cy", (point: DotPlotDataPoint) => yScale(point.y))
.attr("fill", d => d.color)
.attr("stroke", "black")
.attr("stroke-width", this.strokeWidth)
.attr("r", this.radius);
this.renderTooltip(selection);
this.setSelectHandler(selection);
selection.exit().remove();
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
MethodDeclaration |
private setSelectHandler(dotSelection: D3.UpdateSelection): void {
this.setSelection(dotSelection);
dotSelection.on("click", (data: DotPlotDataPoint) => {
this.selectionManager
.select(data.identity, d3.event.ctrlKey)
.then((selectionIds: SelectionId[]) => this.setSelection(dotSelection, selectionIds));
d3.event.stopPropagation();
});
this.svg.on("click", () => {
this.selectionManager.clear();
this.setSelection(dotSelection);
});
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
MethodDeclaration |
private setSelection(selection: D3.UpdateSelection, selectionIds?: SelectionId[]): void {
selection.transition()
.duration(this.durationAnimations)
.style("fill-opacity", this.MaxOpacity);
if (!selectionIds || !selectionIds.length) {
return;
}
selection
.filter((dotSelectionData: DotPlotDataPoint) =>
!selectionIds.some((selectionId: SelectionId) => dotSelectionData.identity === selectionId))
.transition()
.duration(this.durationAnimations)
.style("fill-opacity", this.MinOpacity);
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
MethodDeclaration |
private renderTooltip(selection: D3.UpdateSelection): void {
TooltipManager.addTooltip(selection, (tooltipEvent: TooltipEvent) =>
(<DotPlotDataPoint>tooltipEvent.data).tooltipInfo);
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
MethodDeclaration |
private drawAxis(values: any[], xScale: D3.Scale.OrdinalScale, translateY: number) {
var xAxis = d3.svg.axis()
.scale(xScale)
.orient("bottom")
.tickValues(values);
this.axis.attr("class", "x axis")
.attr('transform', SVGUtil.translate(0, translateY));
this.axis.call(xAxis);
this.relaxTicks(values);
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
MethodDeclaration |
private relaxTicks(values: any[]) {
var xAxisWidth = this.axis.node().getBoundingClientRect().width;
if (values.length !== this.itemsLength) {
var self = this;
this.itemsWidth = 0;
this.itemsLength = values.length;
this.axis.selectAll("text").each(function(d, i) {
self.itemsWidth += d3.select(this).node().getBoundingClientRect().width + 15;
});
}
this.toggleRotateTicks( xAxisWidth < this.itemsWidth ? true : false );
this.toggleHideTicks( xAxisWidth < values.length * 15 ? true : false );
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
MethodDeclaration |
private toggleRotateTicks(state) {
if (state) {
this.axis.selectAll("text")
.attr("dx", ".8em")
.attr("dy", ".15em")
.attr("transform", "rotate(65)")
.style("text-anchor", "start")
.text(function(d) { return (d.length > 5 ? d.substring(0, 5) + '...' : d); });
} else {
this.axis.selectAll("text")
.attr("dx", "0em")
.attr("transform", "rotate(0)")
.style("text-anchor", "middle");
}
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
MethodDeclaration |
private toggleHideTicks(state) {
if (state) {
this.axis.selectAll("text").each(function(d, i) {
if (i % 2) {
d3.select(this).attr('fill', 'transparent');
}
});
return;
}
this.axis.selectAll("text").attr('fill', null);
} | M1Les/PowerBI-visuals | src/Clients/CustomVisuals/visuals/dotPlot/dotPlot.ts | TypeScript |
ArrowFunction |
() => {
let component: StatusChangeComponent;
let fixture: ComponentFixture<StatusChangeComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ StatusChangeComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(StatusChangeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
} | LRANUL/UOP_SE_Y3S2-PUSL3111_API_SOFTWARE_DEVELOPMENT | programs/workspace/cov-track_management-system-client-side-application/cov-track-manager/src/app/health-inspection/citizen-view/status-change/status-change.component.spec.ts | TypeScript |
ArrowFunction |
async () => {
await TestBed.configureTestingModule({
declarations: [ StatusChangeComponent ]
})
.compileComponents();
} | LRANUL/UOP_SE_Y3S2-PUSL3111_API_SOFTWARE_DEVELOPMENT | programs/workspace/cov-track_management-system-client-side-application/cov-track-manager/src/app/health-inspection/citizen-view/status-change/status-change.component.spec.ts | TypeScript |
ArrowFunction |
() => {
fixture = TestBed.createComponent(StatusChangeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
} | LRANUL/UOP_SE_Y3S2-PUSL3111_API_SOFTWARE_DEVELOPMENT | programs/workspace/cov-track_management-system-client-side-application/cov-track-manager/src/app/health-inspection/citizen-view/status-change/status-change.component.spec.ts | TypeScript |
ClassDeclaration |
@Injectable()
export class JwtStrategy extends PassportStrategy(Strategy) {
constructor() {
super({
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
ignoreExpiration: false,
secretOrKey: 'secretKey',
});
}
async validate(payload: any) {
return { userId: payload.sub, username: payload.username };
}
} | kien1872000/music-player-server | src/auth/jwt.strategy.ts | TypeScript |
MethodDeclaration |
async validate(payload: any) {
return { userId: payload.sub, username: payload.username };
} | kien1872000/music-player-server | src/auth/jwt.strategy.ts | TypeScript |
EnumDeclaration |
export enum UserStatus {
ACTIVE = 'active',
AWAY = 'away',
} | rili-live/rili-app | rili-servers/websocket-service/src/constants/index.ts | TypeScript |
FunctionDeclaration |
function apisAnalyticsRouterConfig($stateProvider) {
'ngInject';
$stateProvider
.state('management.apis.detail.analytics', {
template: require("./apis.analytics.route.html")
})
.state('management.apis.detail.analytics.overview', {
url: '/analytics?from&to&q',
template: require('./overview/analytics.html'),
controller: 'ApiAnalyticsController',
controllerAs: 'analyticsCtrl',
data: {
menu: {
label: 'Analytics',
icon: 'insert_chart'
},
perms: {
only: ['api-analytics-r']
},
docs: {
page: 'management-api-analytics'
}
},
params: {
from: {
type: 'int',
dynamic: true
},
to: {
type: 'int',
dynamic: true
},
q: {
type: 'string',
dynamic: true
}
}
})
.state('management.apis.detail.analytics.logs', {
url: '/logs?from&to&q',
template: require('./logs/logs.html'),
controller: 'ApiLogsController',
controllerAs: 'logsCtrl',
data: {
perms: {
only: ['api-log-r']
},
docs: {
page: 'management-api-logs'
}
},
params: {
from: {
type: 'int',
dynamic: true
},
to: {
type: 'int',
dynamic: true
},
q: {
type: 'string',
dynamic: true
}
},
resolve: {
plans: ($stateParams: StateParams, ApiService: ApiService) =>
ApiService.getApiPlans($stateParams['apiId']),
applications: ($stateParams: StateParams, ApiService: ApiService) =>
ApiService.getSubscribers($stateParams['apiId']),
tenants: (TenantService: TenantService) => TenantService.list()
}
})
.state('management.apis.detail.analytics.loggingconfigure', {
url: '/logs/configure',
template: require('./logs/logging-configuration.html'),
controller: 'ApiLoggingConfigurationController',
controllerAs: 'loggingCtrl',
data: {
menu: null,
perms: {
only: ['api-log-u']
},
docs: {
page: 'management-api-logging-configuration'
}
}
})
.state('management.apis.detail.analytics.log', {
url: '/logs/:logId?timestamp&from&to&q',
component: 'log',
resolve: {
log: ($stateParams: StateParams, ApiService: ApiService) =>
ApiService.getLog($stateParams['apiId'], $stateParams['logId'], $stateParams['timestamp']).then(response => response.data)
},
data: {
perms: {
only: ['api-log-r']
},
docs: {
page: 'management-api-log'
}
}
})
.state('management.apis.detail.analytics.pathMappings', {
url: '/path-mappings',
template: require('./pathMappings/pathMappings.html'),
controller: 'ApiPathMappingsController',
controllerAs: 'apiPathMappingCtrl',
data: {
perms: {
only: ['api-definition-r']
},
docs: {
page: 'management-api-pathMappings'
}
}
});
} | nicolashenry/gravitee-management-webui | src/management/api/analytics/apis.analytics.route.ts | TypeScript |
ArrowFunction |
($stateParams: StateParams, ApiService: ApiService) =>
ApiService.getApiPlans($stateParams['apiId']) | nicolashenry/gravitee-management-webui | src/management/api/analytics/apis.analytics.route.ts | TypeScript |
ArrowFunction |
($stateParams: StateParams, ApiService: ApiService) =>
ApiService.getSubscribers($stateParams['apiId']) | nicolashenry/gravitee-management-webui | src/management/api/analytics/apis.analytics.route.ts | TypeScript |
ArrowFunction |
(TenantService: TenantService) => TenantService.list() | nicolashenry/gravitee-management-webui | src/management/api/analytics/apis.analytics.route.ts | TypeScript |
ArrowFunction |
($stateParams: StateParams, ApiService: ApiService) =>
ApiService.getLog($stateParams['apiId'], $stateParams['logId'], $stateParams['timestamp']).then(response => response.data) | nicolashenry/gravitee-management-webui | src/management/api/analytics/apis.analytics.route.ts | TypeScript |
ArrowFunction |
response => response.data | nicolashenry/gravitee-management-webui | src/management/api/analytics/apis.analytics.route.ts | TypeScript |
InterfaceDeclaration |
interface Order {
id: string;
user: User;
items: Product[];
subTotalCost: number;
shipCost: number;
totalCost: number;
date: number;
address: string;
note: string;
firstName: string;
lastName: string;
} | beebapcay/estore-app | src/models/order.ts | TypeScript |
ClassDeclaration |
export default class MdZoomIn extends React.Component<IconBaseProps, any> { } | DiogenesPolanco/DefinitelyTyped | react-icons/md/zoom-in.d.ts | TypeScript |
ArrowFunction |
({ data }) => {
const { title, link, githubLink } = data
return (
<Container>
<Title>{title}</Title>
<LinkWrapper>
{link && (
<OverlayLink href={link} target="_blank">
visit website
</OverlayLink> | eadehemingway/portfolio | src/components/Overlay.tsx | TypeScript |
ArrowFunction |
(request, file, cb) => {
const fileName = `${Date.now()}-${file.originalname}`;
cb(null, fileName);
} | AdrianoRodrigues/nlw03 | backend/src/config/upload.ts | TypeScript |
ClassDeclaration |
@Component({
selector: 'app-marble-diagram',
templateUrl: './marble-diagram.component.html',
styleUrls: ['./marble-diagram.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class MarbleDiagramComponent {
@Input() operatorName: string;
@Input() useInteractiveMarbles: boolean;
@Input() url: string;
} | isabella232/rxjs-docs | src/app/operators/components/marble-diagram/marble-diagram.component.ts | TypeScript |
InterfaceDeclaration |
export interface DefaultLogFields {
hash: string;
date: string;
message: string;
refs: string;
body: string;
author_name: string;
author_email: string;
} | Mayank-Khurmai/Modify-Github-Date-Hack | node_modules/simple-git/src/lib/tasks/log.d.ts | TypeScript |
TypeAliasDeclaration |
export declare type LogOptions<T = DefaultLogFields> = Options | {
format?: T;
file?: string;
from?: string;
multiLine?: boolean;
symmetric?: boolean;
strictDate?: boolean;
to?: string;
}; | Mayank-Khurmai/Modify-Github-Date-Hack | node_modules/simple-git/src/lib/tasks/log.d.ts | TypeScript |
InterfaceDeclaration |
export interface IProxyCall<T> {
id: string;
setupExpression: common.IAction1<T>;
setupCall: ICallContext;
isVerifiable: boolean;
isInSequence: boolean;
expectedCallCount: api.Times;
isInvoked: boolean;
callCount: number;
setVerifiable(
times?: api.Times,
expectedCallType?: api.ExpectedCallType): void;
evaluatedSuccessfully(): void;
matches(call: ICallContext): boolean;
execute(call: ICallContext): void;
} | oshigoto46/discord-clone-go-ts | test-dir/node_modules/typemoq/src/Proxy/IProxyCall.ts | TypeScript |
FunctionDeclaration | /**
* Backend details.
*/
export function getBackend(args: GetBackendArgs, opts?: pulumi.InvokeOptions): Promise<GetBackendResult> {
if (!opts) {
opts = {}
}
if (!opts.version) {
opts.version = utilities.getVersion();
}
return pulumi.runtime.invoke("azure-native:apimanagement/v20180101:getBackend", {
"backendid": args.backendid,
"resourceGroupName": args.resourceGroupName,
"serviceName": args.serviceName,
}, opts);
} | pulumi-bot/pulumi-azure-native | sdk/nodejs/apimanagement/v20180101/getBackend.ts | TypeScript |
InterfaceDeclaration |
export interface GetBackendArgs {
/**
* Identifier of the Backend entity. Must be unique in the current API Management service instance.
*/
readonly backendid: string;
/**
* The name of the resource group.
*/
readonly resourceGroupName: string;
/**
* The name of the API Management service.
*/
readonly serviceName: string;
} | pulumi-bot/pulumi-azure-native | sdk/nodejs/apimanagement/v20180101/getBackend.ts | TypeScript |
InterfaceDeclaration | /**
* Backend details.
*/
export interface GetBackendResult {
/**
* Backend Credentials Contract Properties
*/
readonly credentials?: outputs.apimanagement.v20180101.BackendCredentialsContractResponse;
/**
* Backend Description.
*/
readonly description?: string;
/**
* Resource ID.
*/
readonly id: string;
/**
* Resource name.
*/
readonly name: string;
/**
* Backend Properties contract
*/
readonly properties: outputs.apimanagement.v20180101.BackendPropertiesResponse;
/**
* Backend communication protocol.
*/
readonly protocol: string;
/**
* Backend Proxy Contract Properties
*/
readonly proxy?: outputs.apimanagement.v20180101.BackendProxyContractResponse;
/**
* Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or Api Apps.
*/
readonly resourceId?: string;
/**
* Backend Title.
*/
readonly title?: string;
/**
* Backend TLS Properties
*/
readonly tls?: outputs.apimanagement.v20180101.BackendTlsPropertiesResponse;
/**
* Resource type for API Management resource.
*/
readonly type: string;
/**
* Runtime Url of the Backend.
*/
readonly url: string;
} | pulumi-bot/pulumi-azure-native | sdk/nodejs/apimanagement/v20180101/getBackend.ts | TypeScript |
FunctionDeclaration |
function evil() {
const evilstuff = [
"demonic",
"vile",
"evil",
"merciless",
"greedy",
"ambitious",
"giant",
"mecha",
"divine",
"almighty",
"godly",
"corrupt",
"angelic",
];
return getRandom(evilstuff);
} | NekoOfTheAbyss/lala | functions/generator/story/romcom.ts | TypeScript |
ArrowFunction |
(name: string): string => {
const ml = person();
const fl = person();
const goodcreature = getRandom(
creatures.filter((x) => x.affiliation === 1 || x.affiliation === 0),
);
const evilcreature = getRandom(
creatures.filter((x) => x.affiliation === -1 || x.affiliation === 0),
);
const evilcreature2 = getRandom(
creatures.filter(
(x) =>
(x.affiliation === -1 || x.affiliation === 0) && x !== evilcreature,
),
);
const rand = Math.random();
return `${name ? name : `The ${ml}`} ${
rand > 0.5 ? `and the ${fl} ${getRandom(joins)} to ` : ``
}${
Math.random() < 0.5
? rand > 0.5 ? getRandom(action) : getRandom(actions)
: `${getRandom(fight)}${rand > 0.5 ? `` : `s`}`
} the${Math.random() < 0.5 ? ` ${evil()}` : ``} ${
Math.random() < 0.5 ? person() : evilcreature.name
}${Math.random() < 0.5 ? `, ${capitalize(monster())},` : ``}${
Math.random() < 0.5
? ` with the help of the ${goodcreature.plural}${
Math.random() < 0.5
? ` of ${
Math.random() < 0.5
? `the ${getRandom(directions)}`
: capitalize(namer(4 + Math.floor(Math.random() * 3)))
}`
: ``
}`
: Math.random() < 0.5
? ` facing powerful enemies from the ${evilcreature2.name} clan`
: Math.random() < 0.5
? ` using the power of ${getRandom(powers)}`
: ``
}${
Math.random() < 0.5
? rand > 0.5 ? ` and save the world` : ` and saves the world`
: Math.random() < 0.5
? ` for the sake of their peaceful life`
: Math.random() < 0.5
? ` to reach the final treasure`
: Math.random() < 0.5
? ` to protect what is important to them`
: Math.random() < 0.5
? ` to protect the smiles of innocent children`
: Math.random() < 0.5
? ` to commit war crimes`
: Math.random() < 0.5
? ` to avenge the ${person()}`
: Math.random() < 0.5
? ` for world peace`
: Math.random() < 0.5
? ` but end up forming a truce instead`
: Math.random() < 0.5
? ` but end up with a crushing defeat`
: ` but tragically die`
}.`;
} | NekoOfTheAbyss/lala | functions/generator/story/romcom.ts | TypeScript |
ArrowFunction |
(x) => x.affiliation === 1 || x.affiliation === 0 | NekoOfTheAbyss/lala | functions/generator/story/romcom.ts | TypeScript |
ArrowFunction |
(x) => x.affiliation === -1 || x.affiliation === 0 | NekoOfTheAbyss/lala | functions/generator/story/romcom.ts | TypeScript |
ArrowFunction |
(x) =>
(x.affiliation === -1 || x.affiliation === 0) && x !== evilcreature | NekoOfTheAbyss/lala | functions/generator/story/romcom.ts | TypeScript |
ArrowFunction |
async ( member ) => {
if ( member.user.bot ) { return; }
const dbchannel = await bot.db.collection( 'logs' ).findOne( { guild: member.guild.id } );
if ( !dbchannel ) { return; }
await member.guild.channels.fetch();
const channel = await member.guild.channels.cache.get( dbchannel.channel );
const embed = new MessageEmbed()
.setAuthor( member.user.tag, member.user.avatarURL( { size: 2048, type: 'png', dynamic: true } ) )
.setTitle( 'Пользователь ушел' )
.setThumbnail( member.user.avatarURL( { size: 2048, type: 'png', dynamic: true } ) )
.setDescription( `Пользователь ${member.user.tag} ушел с сервера в ${member.joinedAt.toLocaleString( 'ru' )}` )
.setColor( '#5865f2' );
await channel.send( { embeds: [ embed ] } );
} | ENAPM/Azuna | src/events/guildMemberRemove.logs.ts | TypeScript |
FunctionDeclaration |
export declare function handleReward(event: SubstrateEvent): Promise<void>; | Maxkos941/Module-4 | dist/mappings/mappingHandlers.d.ts | TypeScript |
FunctionDeclaration |
export default function FarmOverviewHero() {
const history = useHistory();
const openDialog = useOpenDialog();
function handleAddPlot() {
history.push('/dashboard/plot/add');
}
function handleAddPlotDirectory() {
openDialog(<PlotAddDirectoryDialog />);
}
return (
<Grid container>
<Grid xs={12} md={6} lg={5} item>
<CardHero>
<StyledImage src={heroSrc} />
<Typography variant="body1">
<Trans>
Farmers earn block rewards and transaction fees by committing
spare space to the network to help secure transactions. This is
where your farm will be once you add a plot.{' '}
<Link
target="_blank"
href="https://github.com/BTCgreen-Network/littlelambocoin-blockchain/wiki/Network-Architecture"
>
Learn more
</Link>
</Trans>
</Typography>
<Button onClick={handleAddPlot} variant="contained" color="primary">
<Trans>Add a Plot</Trans>
</Button>
<Divider />
<Typography variant="body1">
<Trans>
{'Do you have existing plots on this machine? '}
<Link onClick={handleAddPlotDirectory} variant="body1">
Add Plot Directory
</Link>
</Trans>
</Typography>
</CardHero>
</Grid>
</Grid>
);
} | Tony4467/littlelambocoin-blockchain | littlelambocoin-blockchain-gui/src/components/farm/overview/FarmOverviewHero.tsx | TypeScript |
FunctionDeclaration |
function handleAddPlot() {
history.push('/dashboard/plot/add');
} | Tony4467/littlelambocoin-blockchain | littlelambocoin-blockchain-gui/src/components/farm/overview/FarmOverviewHero.tsx | TypeScript |
FunctionDeclaration |
function handleAddPlotDirectory() {
openDialog(<PlotAddDirectoryDialog />);
} | Tony4467/littlelambocoin-blockchain | littlelambocoin-blockchain-gui/src/components/farm/overview/FarmOverviewHero.tsx | TypeScript |
ArrowFunction |
() => {
it('should render correctly', () => {
expect(
render(
<Typography.H3 alignment="left" mode="single-line">
This is H3
</Typography.H3>
).asFragment()
).toMatchSnapshot()
})
it('should render correctly with `as`', () => {
expect(
render(
<Typography.H3 alignment="left" mode="single-line" as="p">
This is a p
</Typography.H3>
).asFragment()
).toMatchSnapshot()
})
} | marsblkm/sourcegraph | client/wildcard/src/components/Typography/Heading/H3.test.tsx | TypeScript |
ArrowFunction |
() => {
expect(
render(
<Typography.H3 alignment="left" mode="single-line">
This is H3
</Typography.H3>
).asFragment()
).toMatchSnapshot()
} | marsblkm/sourcegraph | client/wildcard/src/components/Typography/Heading/H3.test.tsx | TypeScript |
ArrowFunction |
() => {
expect(
render(
<Typography.H3 alignment="left" mode="single-line" as="p">
This is a p
</Typography.H3>
).asFragment()
).toMatchSnapshot()
} | marsblkm/sourcegraph | client/wildcard/src/components/Typography/Heading/H3.test.tsx | TypeScript |
FunctionDeclaration |
function Test() {
return (
<div>
<p>테스트 값d</p>
<p>12</p>
</div>
);
} | sunginHwang/react-starter-with-redux-toolkit | src/components/Test.tsx | TypeScript |
ArrowFunction |
() => SkyraUser | Darqam/skyra | src/lib/extensions/SkyraUser.ts | TypeScript |
ClassDeclaration |
export class SkyraUser extends Structures.get('User') {
// Remove when https://github.com/discordjs/discord.js/pull/4932 lands.
// @ts-expect-error: Setter-Getter combo to make the property never be set.
public set locale(_: string | null) {
// noop
}
public get locale() {
return null;
}
// @ts-expect-error: Setter-Getter combo to make the property never be set.
public set lastMessageID(_: string | null) {
// noop
}
public get lastMessageID() {
return null;
}
public set lastMessageChannelID(_: string | null) {
// noop
}
public get lastMessageChannelID() {
return null;
}
public async fetchRank() {
const list = await this.client.leaderboard.fetch();
const rank = list.get(this.id);
if (!rank) return list.size;
if (!rank.name) rank.name = this.username;
return rank.position;
}
} | Darqam/skyra | src/lib/extensions/SkyraUser.ts | TypeScript |
InterfaceDeclaration |
export interface User {
fetchRank(): Promise<number>;
} | Darqam/skyra | src/lib/extensions/SkyraUser.ts | TypeScript |
MethodDeclaration |
public async fetchRank() {
const list = await this.client.leaderboard.fetch();
const rank = list.get(this.id);
if (!rank) return list.size;
if (!rank.name) rank.name = this.username;
return rank.position;
} | Darqam/skyra | src/lib/extensions/SkyraUser.ts | TypeScript |
ArrowFunction |
(error: any) => {
let unwrapError = this.unwrapHttpError(error);
this.errorsSubject.next(unwrapError);
return Observable.throw(unwrapError);
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
ArrowFunction |
() => {
this.waitingSpinner.stopLoading$.next('');
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
ArrowFunction |
(data) => {
searchParams.append(key, data)
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
ClassDeclaration |
export class ApiGatewayOptions {
method: RequestMethod;
url: string;
headers = {};
params = {};
data = {};
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
ClassDeclaration |
@Injectable()
export class ApiGateway {
// Define the internal Subject we'll use to push errors
private errorsSubject = new Subject<any>();
// Provide the *public* Observable that clients can subscribe to
errors$: Observable<any>;
// Define the internal Subject we'll use to push the command count
private pendingCommandsSubject = new Subject<number>();
private pendingCommandCount = 0;
// Provide the *public* Observable that clients can subscribe to
pendingCommands$: Observable<number>;
constructor(
private http: Http,
private waitingSpinner: WaitingSpinnerService,
private router: Router
) {
// Create our observables from the subjects
this.errors$ = this.errorsSubject.asObservable();
this.pendingCommands$ = this.pendingCommandsSubject.asObservable();
}
get(url, params?) {
let requestParameters: RequestOptionsArgs = {};
let headers = new Headers();
if (!!params) {
requestParameters.search = this.buildUrlSearchParams(params);
}
this.createAuthorizationHeader(headers);
requestParameters.headers = headers;
this.waitingSpinner.startLoading$.next('');
return this.http.get(url, requestParameters)
.map(this.unwrapHttpValue)
.catch((error: any) => {
let unwrapError = this.unwrapHttpError(error);
this.errorsSubject.next(unwrapError);
return Observable.throw(unwrapError);
})
.finally(() => {
this.waitingSpinner.stopLoading$.next('');
});
}
post(url, data) {
let headers = new Headers();
this.createAuthorizationHeader(headers);
this.waitingSpinner.startLoading$.next('');
return this.http.post(url, data, {
headers: headers
})
.map(this.unwrapHttpValue)
.catch((error: any) => {
let unwrapError = this.unwrapHttpError(error);
this.errorsSubject.next(unwrapError);
return Observable.throw(unwrapError);
})
.finally(() => {
this.waitingSpinner.stopLoading$.next('');
});
}
put(url, data) {
let headers = new Headers();
this.createAuthorizationHeader(headers);
this.waitingSpinner.startLoading$.next('');
return this.http.put(url, data, {
headers: headers
}).map(this.unwrapHttpValue)
.catch((error: any) => {
let unwrapError = this.unwrapHttpError(error);
this.errorsSubject.next(unwrapError);
return Observable.throw(unwrapError);
})
.finally(() => {
this.waitingSpinner.stopLoading$.next('');
});
}
delete(url) {
let headers = new Headers();
this.createAuthorizationHeader(headers);
this.waitingSpinner.startLoading$.next('');
return this.http.delete(url, {
headers: headers
}).map(this.unwrapHttpValue)
.catch((error: any) => {
let unwrapError = this.unwrapHttpError(error);
this.errorsSubject.next(unwrapError);
return Observable.throw(unwrapError);
})
.finally(() => {
this.waitingSpinner.stopLoading$.next('');
});
}
private addToken(options: ApiGatewayOptions) {
var userId = this.getTokenFromLocalStorage();
if(!!userId) {
options.headers['access_token'] = userId;
}
}
private getTokenFromLocalStorage(): string {
var matches = localStorage.getItem('bc.token');
if(!!matches) {
let object = JSON.parse(matches);
let dateString = moment(object.timestamp);
let now = moment();
let diff = now.diff(dateString, 'hours');
let validHours = 15;
if (diff > validHours) {
this.router.navigate(['/login']);
return;
}
// compareTime(dateString, now); //to implement
return object['token'];
}
return '';
}
private createAuthorizationHeader(headers: Headers) {
var token = this.getTokenFromLocalStorage();
if(!!token) {
headers.append('access_token', token);
}
}
private getXsrfCookie(): string {
var matches = document.cookie.match(/\bXSRF-TOKEN=([^\s;]+)/);
try {
return (matches && decodeURIComponent(matches[1]));
} catch (decodeError) {
return ("");
}
}
private getEvryClientCookie(): string {
var matches = document.cookie.match(/\bsid=([^\s;]+)/);
try {
return (matches && decodeURIComponent(matches[1]));
} catch (decodeError) {
return ("");
}
}
private buildUrlSearchParams(params: any): URLSearchParams {
var searchParams = new URLSearchParams();
for (var key in params) {
if(Array.isArray(params[key])) {
params[key].forEach((data) => {
searchParams.append(key, data)
});
} else {
if (this.isJsObject(params[key])) {
searchParams.append(key, JSON.stringify(params[key]));
} else {
searchParams.append(key, params[key]);
}
}
}
return searchParams;
}
private isJsObject(o) {
return o !== null && (typeof o === 'function' || typeof o === 'object');
}
private unwrapHttpError(error: any): any {
try {
return (error.json());
} catch (jsonError) {
return ({
code: -1,
message: "An unexpected error occurred."
});
}
}
private unwrapHttpValue(value: Response): any {
return !!value.text() ? value.json() : "";
}
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
MethodDeclaration |
get(url, params?) {
let requestParameters: RequestOptionsArgs = {};
let headers = new Headers();
if (!!params) {
requestParameters.search = this.buildUrlSearchParams(params);
}
this.createAuthorizationHeader(headers);
requestParameters.headers = headers;
this.waitingSpinner.startLoading$.next('');
return this.http.get(url, requestParameters)
.map(this.unwrapHttpValue)
.catch((error: any) => {
let unwrapError = this.unwrapHttpError(error);
this.errorsSubject.next(unwrapError);
return Observable.throw(unwrapError);
})
.finally(() => {
this.waitingSpinner.stopLoading$.next('');
});
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
MethodDeclaration |
post(url, data) {
let headers = new Headers();
this.createAuthorizationHeader(headers);
this.waitingSpinner.startLoading$.next('');
return this.http.post(url, data, {
headers: headers
})
.map(this.unwrapHttpValue)
.catch((error: any) => {
let unwrapError = this.unwrapHttpError(error);
this.errorsSubject.next(unwrapError);
return Observable.throw(unwrapError);
})
.finally(() => {
this.waitingSpinner.stopLoading$.next('');
});
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
MethodDeclaration |
put(url, data) {
let headers = new Headers();
this.createAuthorizationHeader(headers);
this.waitingSpinner.startLoading$.next('');
return this.http.put(url, data, {
headers: headers
}).map(this.unwrapHttpValue)
.catch((error: any) => {
let unwrapError = this.unwrapHttpError(error);
this.errorsSubject.next(unwrapError);
return Observable.throw(unwrapError);
})
.finally(() => {
this.waitingSpinner.stopLoading$.next('');
});
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
MethodDeclaration |
delete(url) {
let headers = new Headers();
this.createAuthorizationHeader(headers);
this.waitingSpinner.startLoading$.next('');
return this.http.delete(url, {
headers: headers
}).map(this.unwrapHttpValue)
.catch((error: any) => {
let unwrapError = this.unwrapHttpError(error);
this.errorsSubject.next(unwrapError);
return Observable.throw(unwrapError);
})
.finally(() => {
this.waitingSpinner.stopLoading$.next('');
});
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
MethodDeclaration |
private addToken(options: ApiGatewayOptions) {
var userId = this.getTokenFromLocalStorage();
if(!!userId) {
options.headers['access_token'] = userId;
}
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
MethodDeclaration |
private getTokenFromLocalStorage(): string {
var matches = localStorage.getItem('bc.token');
if(!!matches) {
let object = JSON.parse(matches);
let dateString = moment(object.timestamp);
let now = moment();
let diff = now.diff(dateString, 'hours');
let validHours = 15;
if (diff > validHours) {
this.router.navigate(['/login']);
return;
}
// compareTime(dateString, now); //to implement
return object['token'];
}
return '';
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
MethodDeclaration |
private createAuthorizationHeader(headers: Headers) {
var token = this.getTokenFromLocalStorage();
if(!!token) {
headers.append('access_token', token);
}
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
MethodDeclaration |
private getXsrfCookie(): string {
var matches = document.cookie.match(/\bXSRF-TOKEN=([^\s;]+)/);
try {
return (matches && decodeURIComponent(matches[1]));
} catch (decodeError) {
return ("");
}
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
MethodDeclaration |
private getEvryClientCookie(): string {
var matches = document.cookie.match(/\bsid=([^\s;]+)/);
try {
return (matches && decodeURIComponent(matches[1]));
} catch (decodeError) {
return ("");
}
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
MethodDeclaration |
private buildUrlSearchParams(params: any): URLSearchParams {
var searchParams = new URLSearchParams();
for (var key in params) {
if(Array.isArray(params[key])) {
params[key].forEach((data) => {
searchParams.append(key, data)
});
} else {
if (this.isJsObject(params[key])) {
searchParams.append(key, JSON.stringify(params[key]));
} else {
searchParams.append(key, params[key]);
}
}
}
return searchParams;
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
MethodDeclaration |
private isJsObject(o) {
return o !== null && (typeof o === 'function' || typeof o === 'object');
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
MethodDeclaration |
private unwrapHttpError(error: any): any {
try {
return (error.json());
} catch (jsonError) {
return ({
code: -1,
message: "An unexpected error occurred."
});
}
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
MethodDeclaration |
private unwrapHttpValue(value: Response): any {
return !!value.text() ? value.json() : "";
} | evry-blockchain/sls-loan-front | client/src/app/api-gateway.service.ts | TypeScript |
ClassDeclaration |
export class LocalStorage {
static get<T>(identifier: string) : T | null {
const itemStr = localStorage.getItem(identifier);
if (itemStr === null) return null;
return JSON.parse(itemStr);
}
static set(identifier: string, value: any) {
localStorage.setItem(identifier, JSON.stringify(value));
}
static getOrDefault<T>(identifier: string, defaultVal: T) : T {
const getRes = LocalStorage.get<T>(identifier);
if (getRes !== null) return getRes;
return defaultVal;
}
} | MattCarothers/cont3xt | src/Util/LocalStorage.ts | TypeScript |
MethodDeclaration |
static get<T>(identifier: string) : T | null {
const itemStr = localStorage.getItem(identifier);
if (itemStr === null) return null;
return JSON.parse(itemStr);
} | MattCarothers/cont3xt | src/Util/LocalStorage.ts | TypeScript |
MethodDeclaration |
static set(identifier: string, value: any) {
localStorage.setItem(identifier, JSON.stringify(value));
} | MattCarothers/cont3xt | src/Util/LocalStorage.ts | TypeScript |
MethodDeclaration |
static getOrDefault<T>(identifier: string, defaultVal: T) : T {
const getRes = LocalStorage.get<T>(identifier);
if (getRes !== null) return getRes;
return defaultVal;
} | MattCarothers/cont3xt | src/Util/LocalStorage.ts | TypeScript |
FunctionDeclaration |
export async function mutation<T, K>(url: string, payload: T, method: string = 'POST'): Promise<K | null> {
const response = await fetch(url, {
method,
body: JSON.stringify(payload),
headers: {
'Content-Type': 'application/json',
},
});
const responseJSON = await response.json();
const responseDTO = responseJSON as ResponseDTO<K>;
if (responseDTO.error) {
return null;
}
if (!responseDTO.data) {
return null;
}
return responseDTO.data;
} | BizzareEcho/mvp-match-assignment | lib/mutation.ts | TypeScript |
ArrowFunction |
() => {
sprites.forEach(sprite => {
sprite.rotation += 0.01;
});
} | Mattykins/dev | examples/src/textures/change sprites with texture.ts | TypeScript |
ArrowFunction |
sprite => {
sprite.rotation += 0.01;
} | Mattykins/dev | examples/src/textures/change sprites with texture.ts | TypeScript |
ArrowFunction |
() => {
RemoveTexture('floppy', 'golem');
} | Mattykins/dev | examples/src/textures/change sprites with texture.ts | TypeScript |
ClassDeclaration |
class Demo extends Scene
{
constructor ()
{
super();
this.create();
}
async create ()
{
const loader = new Loader();
loader.add(
ImageFile('disk', 'assets/items/disk1.png'),
ImageFile('floppy', 'assets/items/floppy2.png'),
ImageFile('tape', 'assets/items/tape3.png'),
ImageFile('golem', 'assets/golem.png')
);
await loader.start();
const world = new StaticWorld(this);
const frames = [ 'disk', 'floppy', 'tape' ];
for (let i = 0; i < 64; i++)
{
const x = Between(0, 800);
const y = Between(0, 600);
AddChild(world, new Sprite(x, y, GetRandom(frames)));
}
const sprites: ISprite[] = GetChildrenFromParentID(world.id) as ISprite[];
On(world, 'update', () => {
sprites.forEach(sprite => {
sprite.rotation += 0.01;
});
});
setTimeout(() => {
RemoveTexture('floppy', 'golem');
}, 2000);
}
} | Mattykins/dev | examples/src/textures/change sprites with texture.ts | TypeScript |
MethodDeclaration |
async create ()
{
const loader = new Loader();
loader.add(
ImageFile('disk', 'assets/items/disk1.png'),
ImageFile('floppy', 'assets/items/floppy2.png'),
ImageFile('tape', 'assets/items/tape3.png'),
ImageFile('golem', 'assets/golem.png')
);
await loader.start();
const world = new StaticWorld(this);
const frames = [ 'disk', 'floppy', 'tape' ];
for (let i = 0; i < 64; i++)
{
const x = Between(0, 800);
const y = Between(0, 600);
AddChild(world, new Sprite(x, y, GetRandom(frames)));
}
const sprites: ISprite[] = GetChildrenFromParentID(world.id) as ISprite[];
On(world, 'update', () => {
sprites.forEach(sprite => {
sprite.rotation += 0.01;
});
});
setTimeout(() => {
RemoveTexture('floppy', 'golem');
}, 2000);
} | Mattykins/dev | examples/src/textures/change sprites with texture.ts | TypeScript |
ClassDeclaration | /**
* Azure Firewall resource
*/
export class AzureFirewall extends pulumi.CustomResource {
/**
* Get an existing AzureFirewall resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): AzureFirewall {
return new AzureFirewall(name, undefined as any, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'azure-nextgen:network/v20180701:AzureFirewall';
/**
* Returns true if the given object is an instance of AzureFirewall. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is AzureFirewall {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === AzureFirewall.__pulumiType;
}
/**
* Collection of application rule collections used by a Azure Firewall.
*/
public readonly applicationRuleCollections!: pulumi.Output<outputs.network.v20180701.AzureFirewallApplicationRuleCollectionResponse[] | undefined>;
/**
* Gets a unique read-only string that changes whenever the resource is updated.
*/
public /*out*/ readonly etag!: pulumi.Output<string>;
/**
* IP configuration of the Azure Firewall resource.
*/
public readonly ipConfigurations!: pulumi.Output<outputs.network.v20180701.AzureFirewallIPConfigurationResponse[] | undefined>;
/**
* Resource location.
*/
public readonly location!: pulumi.Output<string | undefined>;
/**
* Resource name.
*/
public /*out*/ readonly name!: pulumi.Output<string>;
/**
* Collection of network rule collections used by a Azure Firewall.
*/
public readonly networkRuleCollections!: pulumi.Output<outputs.network.v20180701.AzureFirewallNetworkRuleCollectionResponse[] | undefined>;
/**
* The provisioning state of the resource.
*/
public /*out*/ readonly provisioningState!: pulumi.Output<string>;
/**
* Resource tags.
*/
public readonly tags!: pulumi.Output<{[key: string]: string} | undefined>;
/**
* Resource type.
*/
public /*out*/ readonly type!: pulumi.Output<string>;
/**
* Create a AzureFirewall resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: AzureFirewallArgs, opts?: pulumi.CustomResourceOptions) {
let inputs: pulumi.Inputs = {};
if (!(opts && opts.id)) {
if (!args || args.azureFirewallName === undefined) {
throw new Error("Missing required property 'azureFirewallName'");
}
if (!args || args.resourceGroupName === undefined) {
throw new Error("Missing required property 'resourceGroupName'");
}
inputs["applicationRuleCollections"] = args ? args.applicationRuleCollections : undefined;
inputs["azureFirewallName"] = args ? args.azureFirewallName : undefined;
inputs["id"] = args ? args.id : undefined;
inputs["ipConfigurations"] = args ? args.ipConfigurations : undefined;
inputs["location"] = args ? args.location : undefined;
inputs["networkRuleCollections"] = args ? args.networkRuleCollections : undefined;
inputs["resourceGroupName"] = args ? args.resourceGroupName : undefined;
inputs["tags"] = args ? args.tags : undefined;
inputs["etag"] = undefined /*out*/;
inputs["name"] = undefined /*out*/;
inputs["provisioningState"] = undefined /*out*/;
inputs["type"] = undefined /*out*/;
} else {
inputs["applicationRuleCollections"] = undefined /*out*/;
inputs["etag"] = undefined /*out*/;
inputs["ipConfigurations"] = undefined /*out*/;
inputs["location"] = undefined /*out*/;
inputs["name"] = undefined /*out*/;
inputs["networkRuleCollections"] = undefined /*out*/;
inputs["provisioningState"] = undefined /*out*/;
inputs["tags"] = undefined /*out*/;
inputs["type"] = undefined /*out*/;
}
if (!opts) {
opts = {}
}
if (!opts.version) {
opts.version = utilities.getVersion();
}
const aliasOpts = { aliases: [{ type: "azure-nextgen:network/latest:AzureFirewall" }, { type: "azure-nextgen:network/v20180401:AzureFirewall" }, { type: "azure-nextgen:network/v20180601:AzureFirewall" }, { type: "azure-nextgen:network/v20180801:AzureFirewall" }, { type: "azure-nextgen:network/v20181001:AzureFirewall" }, { type: "azure-nextgen:network/v20181101:AzureFirewall" }, { type: "azure-nextgen:network/v20181201:AzureFirewall" }, { type: "azure-nextgen:network/v20190201:AzureFirewall" }, { type: "azure-nextgen:network/v20190401:AzureFirewall" }, { type: "azure-nextgen:network/v20190601:AzureFirewall" }, { type: "azure-nextgen:network/v20190701:AzureFirewall" }, { type: "azure-nextgen:network/v20190801:AzureFirewall" }, { type: "azure-nextgen:network/v20190901:AzureFirewall" }, { type: "azure-nextgen:network/v20191101:AzureFirewall" }, { type: "azure-nextgen:network/v20191201:AzureFirewall" }, { type: "azure-nextgen:network/v20200301:AzureFirewall" }, { type: "azure-nextgen:network/v20200401:AzureFirewall" }, { type: "azure-nextgen:network/v20200501:AzureFirewall" }, { type: "azure-nextgen:network/v20200601:AzureFirewall" }, { type: "azure-nextgen:network/v20200701:AzureFirewall" }] };
opts = opts ? pulumi.mergeOptions(opts, aliasOpts) : aliasOpts;
super(AzureFirewall.__pulumiType, name, inputs, opts);
}
} | test-wiz-sec/pulumi-azure-nextgen | sdk/nodejs/network/v20180701/azureFirewall.ts | TypeScript |
InterfaceDeclaration | /**
* The set of arguments for constructing a AzureFirewall resource.
*/
export interface AzureFirewallArgs {
/**
* Collection of application rule collections used by a Azure Firewall.
*/
readonly applicationRuleCollections?: pulumi.Input<pulumi.Input<inputs.network.v20180701.AzureFirewallApplicationRuleCollection>[]>;
/**
* The name of the Azure Firewall.
*/
readonly azureFirewallName: pulumi.Input<string>;
/**
* Resource ID.
*/
readonly id?: pulumi.Input<string>;
/**
* IP configuration of the Azure Firewall resource.
*/
readonly ipConfigurations?: pulumi.Input<pulumi.Input<inputs.network.v20180701.AzureFirewallIPConfiguration>[]>;
/**
* Resource location.
*/
readonly location?: pulumi.Input<string>;
/**
* Collection of network rule collections used by a Azure Firewall.
*/
readonly networkRuleCollections?: pulumi.Input<pulumi.Input<inputs.network.v20180701.AzureFirewallNetworkRuleCollection>[]>;
/**
* The name of the resource group.
*/
readonly resourceGroupName: pulumi.Input<string>;
/**
* Resource tags.
*/
readonly tags?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
} | test-wiz-sec/pulumi-azure-nextgen | sdk/nodejs/network/v20180701/azureFirewall.ts | TypeScript |
MethodDeclaration | /**
* Get an existing AzureFirewall resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): AzureFirewall {
return new AzureFirewall(name, undefined as any, { ...opts, id: id });
} | test-wiz-sec/pulumi-azure-nextgen | sdk/nodejs/network/v20180701/azureFirewall.ts | TypeScript |
MethodDeclaration | /**
* Returns true if the given object is an instance of AzureFirewall. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is AzureFirewall {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === AzureFirewall.__pulumiType;
} | test-wiz-sec/pulumi-azure-nextgen | sdk/nodejs/network/v20180701/azureFirewall.ts | TypeScript |
FunctionDeclaration | // deno-lint-ignore no-explicit-any
function createIterResult(value: any, done: boolean): IteratorResult<any> {
return { value, done };
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
FunctionDeclaration | // deno-lint-ignore no-explicit-any
function eventHandler(...args: any[]): void {
const promise = unconsumedPromises.shift();
if (promise) {
promise.resolve(createIterResult(args, false));
} else {
unconsumedEventValues.push(args);
}
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
FunctionDeclaration | // deno-lint-ignore no-explicit-any
function errorHandler(err: any): void {
finished = true;
const toError = unconsumedPromises.shift();
if (toError) {
toError.reject(err);
} else {
// The next time we call next()
error = err;
}
iterator.return();
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
ArrowFunction |
(value: string | symbol) => {
this.removeAllListeners(value);
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
ArrowFunction |
(resolve, reject) => {
if (emitter instanceof EventTarget) {
// EventTarget does not have `error` event semantics like Node
// EventEmitters, we do not listen to `error` events here.
emitter.addEventListener(
name,
(...args) => {
resolve(args);
},
{ once: true, passive: false, capture: false },
);
return;
} else if (emitter instanceof EventEmitter) {
// deno-lint-ignore no-explicit-any
const eventListener = (...args: any[]): void => {
if (errorListener !== undefined) {
emitter.removeListener("error", errorListener);
}
resolve(args);
};
let errorListener: GenericFunction;
// Adding an error listener is not optional because
// if an error is thrown on an event emitter we cannot
// guarantee that the actual event we are waiting will
// be fired. The result could be a silent way to create
// memory or file descriptor leaks, which is something
// we should avoid.
if (name !== "error") {
// deno-lint-ignore no-explicit-any
errorListener = (err: any): void => {
emitter.removeListener(name, eventListener);
reject(err);
};
emitter.once("error", errorListener);
}
emitter.once(name, eventListener);
return;
}
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
ArrowFunction |
(...args) => {
resolve(args);
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
Subsets and Splits