type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
ArrowFunction |
(...args: any[]): void => {
if (errorListener !== undefined) {
emitter.removeListener("error", errorListener);
}
resolve(args);
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
ArrowFunction |
(err: any): void => {
emitter.removeListener(name, eventListener);
reject(err);
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
InterfaceDeclaration |
export interface WrappedFunction extends Function {
listener: GenericFunction;
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
InterfaceDeclaration |
interface AsyncIterable {
// deno-lint-ignore no-explicit-any
next(): Promise<IteratorResult<any, any>>;
// deno-lint-ignore no-explicit-any
return(): Promise<IteratorResult<any, any>>;
throw(err: Error): void;
// deno-lint-ignore no-explicit-any
[Symbol.asyncIterator](): any;
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
TypeAliasDeclaration | // deno-lint-ignore no-explicit-any
export type GenericFunction = (...args: any[]) => any; | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration |
private _addListener(
eventName: string | symbol,
listener: GenericFunction | WrappedFunction,
prepend: boolean,
): this {
this.emit("newListener", eventName, listener);
if (this._events.has(eventName)) {
const listeners = this._events.get(eventName) as Array<
GenericFunction | WrappedFunction
>;
if (prepend) {
listeners.unshift(listener);
} else {
listeners.push(listener);
}
} else {
this._events.set(eventName, [listener]);
}
const max = this.getMaxListeners();
if (max > 0 && this.listenerCount(eventName) > max) {
const warning = new Error(
`Possible EventEmitter memory leak detected.
${this.listenerCount(eventName)} ${eventName.toString()} listeners.
Use emitter.setMaxListeners() to increase limit`,
);
warning.name = "MaxListenersExceededWarning";
console.warn(warning);
}
return this;
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /** Alias for emitter.on(eventName, listener). */
public addListener(
eventName: string | symbol,
listener: GenericFunction | WrappedFunction,
): this {
return this._addListener(eventName, listener, false);
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /**
* Synchronously calls each of the listeners registered for the event named
* eventName, in the order they were registered, passing the supplied
* arguments to each.
* @return true if the event had listeners, false otherwise
*/
// deno-lint-ignore no-explicit-any
public emit(eventName: string | symbol, ...args: any[]): boolean {
if (this._events.has(eventName)) {
if (
eventName === "error" &&
this._events.get(EventEmitter.errorMonitor)
) {
this.emit(EventEmitter.errorMonitor, ...args);
}
const listeners = (this._events.get(
eventName,
) as GenericFunction[]).slice(); // We copy with slice() so array is not mutated during emit
for (const listener of listeners) {
try {
listener.apply(this, args);
} catch (err) {
this.emit("error", err);
}
}
return true;
} else if (eventName === "error") {
if (this._events.get(EventEmitter.errorMonitor)) {
this.emit(EventEmitter.errorMonitor, ...args);
}
const errMsg = args.length > 0 ? args[0] : Error("Unhandled error.");
throw errMsg;
}
return false;
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /**
* Returns an array listing the events for which the emitter has
* registered listeners.
*/
public eventNames(): [string | symbol] {
return Array.from(this._events.keys()) as [string | symbol];
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /**
* Returns the current max listener value for the EventEmitter which is
* either set by emitter.setMaxListeners(n) or defaults to
* EventEmitter.defaultMaxListeners.
*/
public getMaxListeners(): number {
return this.maxListeners || EventEmitter.defaultMaxListeners;
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /**
* Returns the number of listeners listening to the event named
* eventName.
*/
public listenerCount(eventName: string | symbol): number {
if (this._events.has(eventName)) {
return (this._events.get(eventName) as GenericFunction[]).length;
} else {
return 0;
}
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration |
static listenerCount(
emitter: EventEmitter,
eventName: string | symbol,
): number {
return emitter.listenerCount(eventName);
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration |
private _listeners(
target: EventEmitter,
eventName: string | symbol,
unwrap: boolean,
): GenericFunction[] {
if (!target._events.has(eventName)) {
return [];
}
const eventListeners = target._events.get(eventName) as GenericFunction[];
return unwrap
? this.unwrapListeners(eventListeners)
: eventListeners.slice(0);
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration |
private unwrapListeners(arr: GenericFunction[]): GenericFunction[] {
const unwrappedListeners = new Array(arr.length) as GenericFunction[];
for (let i = 0; i < arr.length; i++) {
// deno-lint-ignore no-explicit-any
unwrappedListeners[i] = (arr[i] as any)["listener"] || arr[i];
}
return unwrappedListeners;
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /** Returns a copy of the array of listeners for the event named eventName.*/
public listeners(eventName: string | symbol): GenericFunction[] {
return this._listeners(this, eventName, true);
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /**
* Returns a copy of the array of listeners for the event named eventName,
* including any wrappers (such as those created by .once()).
*/
public rawListeners(
eventName: string | symbol,
): Array<GenericFunction | WrappedFunction> {
return this._listeners(this, eventName, false);
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /** Alias for emitter.removeListener(). */
public off(eventName: string | symbol, listener: GenericFunction): this {
return this.removeListener(eventName, listener);
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /**
* Adds the listener function to the end of the listeners array for the event
* named eventName. No checks are made to see if the listener has already
* been added. Multiple calls passing the same combination of eventName and
* listener will result in the listener being added, and called, multiple
* times.
*/
public on(
eventName: string | symbol,
listener: GenericFunction | WrappedFunction,
): this {
return this._addListener(eventName, listener, false);
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /**
* Adds a one-time listener function for the event named eventName. The next
* time eventName is triggered, this listener is removed and then invoked.
*/
public once(eventName: string | symbol, listener: GenericFunction): this {
const wrapped: WrappedFunction = this.onceWrap(eventName, listener);
this.on(eventName, wrapped);
return this;
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | // Wrapped function that calls EventEmitter.removeListener(eventName, self) on execution.
private onceWrap(
eventName: string | symbol,
listener: GenericFunction,
): WrappedFunction {
const wrapper = function (
this: {
eventName: string | symbol;
listener: GenericFunction;
rawListener: GenericFunction | WrappedFunction;
context: EventEmitter;
},
// deno-lint-ignore no-explicit-any
...args: any[]
): void {
this.context.removeListener(
this.eventName,
this.rawListener as GenericFunction,
);
this.listener.apply(this.context, args);
};
const wrapperContext = {
eventName: eventName,
listener: listener,
rawListener: (wrapper as unknown) as WrappedFunction,
context: this,
};
const wrapped = (wrapper.bind(
wrapperContext,
) as unknown) as WrappedFunction;
wrapperContext.rawListener = wrapped;
wrapped.listener = listener;
return wrapped as WrappedFunction;
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /**
* Adds the listener function to the beginning of the listeners array for the
* event named eventName. No checks are made to see if the listener has
* already been added. Multiple calls passing the same combination of
* eventName and listener will result in the listener being added, and
* called, multiple times.
*/
public prependListener(
eventName: string | symbol,
listener: GenericFunction | WrappedFunction,
): this {
return this._addListener(eventName, listener, true);
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /**
* Adds a one-time listener function for the event named eventName to the
* beginning of the listeners array. The next time eventName is triggered,
* this listener is removed, and then invoked.
*/
public prependOnceListener(
eventName: string | symbol,
listener: GenericFunction,
): this {
const wrapped: WrappedFunction = this.onceWrap(eventName, listener);
this.prependListener(eventName, wrapped);
return this;
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /** Removes all listeners, or those of the specified eventName. */
public removeAllListeners(eventName?: string | symbol): this {
if (this._events === undefined) {
return this;
}
if (eventName) {
if (this._events.has(eventName)) {
const listeners = (this._events.get(eventName) as Array<
GenericFunction | WrappedFunction
>).slice(); // Create a copy; We use it AFTER it's deleted.
this._events.delete(eventName);
for (const listener of listeners) {
this.emit("removeListener", eventName, listener);
}
}
} else {
const eventList: [string | symbol] = this.eventNames();
eventList.map((value: string | symbol) => {
this.removeAllListeners(value);
});
}
return this;
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /**
* Removes the specified listener from the listener array for the event
* named eventName.
*/
public removeListener(
eventName: string | symbol,
listener: GenericFunction,
): this {
if (this._events.has(eventName)) {
const arr:
| Array<GenericFunction | WrappedFunction>
| undefined = this._events.get(eventName);
assert(arr);
let listenerIndex = -1;
for (let i = arr.length - 1; i >= 0; i--) {
// arr[i]["listener"] is the reference to the listener inside a bound 'once' wrapper
if (
arr[i] == listener ||
(arr[i] && (arr[i] as WrappedFunction)["listener"] == listener)
) {
listenerIndex = i;
break;
}
}
if (listenerIndex >= 0) {
arr.splice(listenerIndex, 1);
this.emit("removeListener", eventName, listener);
if (arr.length === 0) {
this._events.delete(eventName);
}
}
}
return this;
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /**
* By default EventEmitters will print a warning if more than 10 listeners
* are added for a particular event. This is a useful default that helps
* finding memory leaks. Obviously, not all events should be limited to just
* 10 listeners. The emitter.setMaxListeners() method allows the limit to be
* modified for this specific EventEmitter instance. The value can be set to
* Infinity (or 0) to indicate an unlimited number of listeners.
*/
public setMaxListeners(n: number): this {
if (n !== Infinity) {
if (n === 0) {
n = Infinity;
} else {
validateIntegerRange(n, "maxListeners", 0);
}
}
this.maxListeners = n;
return this;
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | /**
* Creates a Promise that is fulfilled when the EventEmitter emits the given
* event or that is rejected when the EventEmitter emits 'error'. The Promise
* will resolve with an array of all the arguments emitted to the given event.
*/
public static once(
emitter: EventEmitter | EventTarget,
name: string,
// deno-lint-ignore no-explicit-any
): Promise<any[]> {
return new Promise((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 |
MethodDeclaration | /**
* Returns an AsyncIterator that iterates eventName events. It will throw if
* the EventEmitter emits 'error'. It removes all listeners when exiting the
* loop. The value returned by each iteration is an array composed of the
* emitted event arguments.
*/
public static on(
emitter: EventEmitter,
event: string | symbol,
): AsyncIterable {
// deno-lint-ignore no-explicit-any
const unconsumedEventValues: any[] = [];
// deno-lint-ignore no-explicit-any
const unconsumedPromises: any[] = [];
let error: Error | null = null;
let finished = false;
const iterator = {
// deno-lint-ignore no-explicit-any
next(): Promise<IteratorResult<any>> {
// First, we consume all unread events
// deno-lint-ignore no-explicit-any
const value: any = unconsumedEventValues.shift();
if (value) {
return Promise.resolve(createIterResult(value, false));
}
// Then we error, if an error happened
// This happens one time if at all, because after 'error'
// we stop listening
if (error) {
const p: Promise<never> = Promise.reject(error);
// Only the first element errors
error = null;
return p;
}
// If the iterator is finished, resolve to done
if (finished) {
return Promise.resolve(createIterResult(undefined, true));
}
// Wait until an event happens
return new Promise(function (resolve, reject) {
unconsumedPromises.push({ resolve, reject });
});
},
// deno-lint-ignore no-explicit-any
return(): Promise<IteratorResult<any>> {
emitter.removeListener(event, eventHandler);
emitter.removeListener("error", errorHandler);
finished = true;
for (const promise of unconsumedPromises) {
promise.resolve(createIterResult(undefined, true));
}
return Promise.resolve(createIterResult(undefined, true));
},
throw(err: Error): void {
error = err;
emitter.removeListener(event, eventHandler);
emitter.removeListener("error", errorHandler);
},
// deno-lint-ignore no-explicit-any
[Symbol.asyncIterator](): any {
return this;
},
};
emitter.on(event, eventHandler);
emitter.on("error", errorHandler);
return iterator;
// 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);
}
}
// 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 |
MethodDeclaration | // deno-lint-ignore no-explicit-any
next(): Promise<IteratorResult<any>> {
// First, we consume all unread events
// deno-lint-ignore no-explicit-any
const value: any = unconsumedEventValues.shift();
if (value) {
return Promise.resolve(createIterResult(value, false));
}
// Then we error, if an error happened
// This happens one time if at all, because after 'error'
// we stop listening
if (error) {
const p: Promise<never> = Promise.reject(error);
// Only the first element errors
error = null;
return p;
}
// If the iterator is finished, resolve to done
if (finished) {
return Promise.resolve(createIterResult(undefined, true));
}
// Wait until an event happens
return new Promise(function (resolve, reject) {
unconsumedPromises.push({ resolve, reject });
});
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | // deno-lint-ignore no-explicit-any
return(): Promise<IteratorResult<any>> {
emitter.removeListener(event, eventHandler);
emitter.removeListener("error", errorHandler);
finished = true;
for (const promise of unconsumedPromises) {
promise.resolve(createIterResult(undefined, true));
}
return Promise.resolve(createIterResult(undefined, true));
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration |
throw(err: Error): void {
error = err;
emitter.removeListener(event, eventHandler);
emitter.removeListener("error", errorHandler);
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
MethodDeclaration | // deno-lint-ignore no-explicit-any
[Symbol.asyncIterator](): any {
return this;
} | 0xe/swc | crates/swc_bundler/tests/.cache/deno/f3fc479f331dd963cd2b96063df6bf047890f887.ts | TypeScript |
ArrowFunction |
(type) => Item | fullajtar/bachelors_thesis | src/product/product.entity.ts | TypeScript |
ArrowFunction |
(item) => item.invoiceItemList | fullajtar/bachelors_thesis | src/product/product.entity.ts | TypeScript |
ArrowFunction |
(type) => Invoice | fullajtar/bachelors_thesis | src/product/product.entity.ts | TypeScript |
ArrowFunction |
(invoice) => invoice.invoiceItemLists | fullajtar/bachelors_thesis | src/product/product.entity.ts | TypeScript |
ArrowFunction |
(type) => Order | fullajtar/bachelors_thesis | src/product/product.entity.ts | TypeScript |
ArrowFunction |
(order) => order.invoiceItemLists | fullajtar/bachelors_thesis | src/product/product.entity.ts | TypeScript |
ClassDeclaration |
@Entity()
export class Product extends BaseEntity {
@PrimaryGeneratedColumn()
id: number;
@Column(
"decimal", {scale: 2}
)
quantity: number;
@Column(
"decimal", {scale: 2}
)
discount: number;
@ManyToOne((type) => Item, (item) => item.invoiceItemList, {
eager: true,
cascade: true,
})
item: Item;
@ManyToOne((type) => Invoice, (invoice) => invoice.invoiceItemLists, {
eager: false,
})
invoice: Invoice;
@ManyToOne((type) => Order, (order) => order.invoiceItemLists, {
eager: false,
})
order: Order;
} | fullajtar/bachelors_thesis | src/product/product.entity.ts | TypeScript |
ArrowFunction |
() => {
this.fs.getBefriendedUsers(this.profileservice.user).subscribe(data=> {
data.forEach(friendship => {
if(friendship.user1.id!=this.profileservice.user.id) {
this.cs.getKeyUser(friendship.user1).subscribe(data => {
this.allFriends.push(data);
})
} else {
this.cs.getKeyUser(friendship.user2).subscribe(data => {
this.allFriends.push(data);
})
}
});
console.log(this.allFriends);
})
} | Connect-HTL-Leonding/Connect | application/application/src/app/pages/meetup-data/meetup-data.page.ts | TypeScript |
ArrowFunction |
data=> {
data.forEach(friendship => {
if(friendship.user1.id!=this.profileservice.user.id) {
this.cs.getKeyUser(friendship.user1).subscribe(data => {
this.allFriends.push(data);
})
} else {
this.cs.getKeyUser(friendship.user2).subscribe(data => {
this.allFriends.push(data);
})
}
});
console.log(this.allFriends);
} | Connect-HTL-Leonding/Connect | application/application/src/app/pages/meetup-data/meetup-data.page.ts | TypeScript |
ArrowFunction |
friendship => {
if(friendship.user1.id!=this.profileservice.user.id) {
this.cs.getKeyUser(friendship.user1).subscribe(data => {
this.allFriends.push(data);
})
} else {
this.cs.getKeyUser(friendship.user2).subscribe(data => {
this.allFriends.push(data);
})
}
} | Connect-HTL-Leonding/Connect | application/application/src/app/pages/meetup-data/meetup-data.page.ts | TypeScript |
ArrowFunction |
data => {
this.allFriends.push(data);
} | Connect-HTL-Leonding/Connect | application/application/src/app/pages/meetup-data/meetup-data.page.ts | TypeScript |
ArrowFunction |
data=> {
let dataForPost: Array<Object> = new Array();
this.selectedFriends.forEach(friend => {
// The same as Meeting_User in the backend
dataForPost.push({
meeting: data,
user_id: friend.id,
status: "pending",
})
});
this.ms.setOtherUser(dataForPost).subscribe(data=> {
this.contactlistService.contactlistObservable.next("contactListUpdate");
this.ms.createMeetupObservable.next("newMeetup:" + this.selectedRoom.id);
})
this.dismissAll()
} | Connect-HTL-Leonding/Connect | application/application/src/app/pages/meetup-data/meetup-data.page.ts | TypeScript |
ArrowFunction |
friend => {
// The same as Meeting_User in the backend
dataForPost.push({
meeting: data,
user_id: friend.id,
status: "pending",
})
} | Connect-HTL-Leonding/Connect | application/application/src/app/pages/meetup-data/meetup-data.page.ts | TypeScript |
ArrowFunction |
data=> {
this.contactlistService.contactlistObservable.next("contactListUpdate");
this.ms.createMeetupObservable.next("newMeetup:" + this.selectedRoom.id);
} | Connect-HTL-Leonding/Connect | application/application/src/app/pages/meetup-data/meetup-data.page.ts | TypeScript |
ClassDeclaration |
@Component({
selector: 'app-meetup-data',
templateUrl: './meetup-data.page.html',
styleUrls: ['./meetup-data.page.scss'],
})
export class MeetupDataPage implements OnInit {
public http;
public day = null;
public timeOfDay = null;
public time : Date= null;
public meetupName : String =null;
public meetup: Meeting;
public profileservice;
ms : MeetupService;
fs;
minDate: string = new Date().toISOString();
public selectedFriends = new Array();
public allFriends = new Array();
public cs;
public keyUser = {
id: 0,
userName: "",
firstname: "",
lastname: "",
email: ""
}
constructor(private popoverController: PopoverController, public contactlistService : ContactlistService, profileservice : ProfileService, ms:MeetupService, friendshipService: FriendshipService, contactList: ContactlistService) {
this.ms = ms;
this.cs = contactList;
this.fs = friendshipService;
this.profileservice = profileservice;
}
@Input() otherUser;
@Input() position;
@Input() mp:MeetupPage;
@Input() selectedRoom: Room;
ngOnInit() {
this.profileservice.getUser().add(() => {
this.fs.getBefriendedUsers(this.profileservice.user).subscribe(data=> {
data.forEach(friendship => {
if(friendship.user1.id!=this.profileservice.user.id) {
this.cs.getKeyUser(friendship.user1).subscribe(data => {
this.allFriends.push(data);
})
} else {
this.cs.getKeyUser(friendship.user2).subscribe(data => {
this.allFriends.push(data);
})
}
});
console.log(this.allFriends);
})
});
}
setKeyUser(user) {
}
public createMeeting() {
this.time = new Date(this.day);
this.time.setUTCHours(new Date(this.timeOfDay).getHours());
this.time.setUTCMinutes(new Date(this.timeOfDay).getMinutes());
this.time.setUTCSeconds(new Date(this.timeOfDay).getSeconds());
this.meetup = new Meeting(0, this.meetupName, this.time, this.position);
this.ms.createMeetup(this.meetup).subscribe(data=> {
let dataForPost: Array<Object> = new Array();
this.selectedFriends.forEach(friend => {
// The same as Meeting_User in the backend
dataForPost.push({
meeting: data,
user_id: friend.id,
status: "pending",
})
});
this.ms.setOtherUser(dataForPost).subscribe(data=> {
this.contactlistService.contactlistObservable.next("contactListUpdate");
this.ms.createMeetupObservable.next("newMeetup:" + this.selectedRoom.id);
})
this.dismissAll()
})
}
async dismissPopover() {
await this.popoverController.dismiss();
}
async dismissAll() {
await this.popoverController.dismiss();
this.mp.dismissModal();
}
} | Connect-HTL-Leonding/Connect | application/application/src/app/pages/meetup-data/meetup-data.page.ts | TypeScript |
MethodDeclaration |
ngOnInit() {
this.profileservice.getUser().add(() => {
this.fs.getBefriendedUsers(this.profileservice.user).subscribe(data=> {
data.forEach(friendship => {
if(friendship.user1.id!=this.profileservice.user.id) {
this.cs.getKeyUser(friendship.user1).subscribe(data => {
this.allFriends.push(data);
})
} else {
this.cs.getKeyUser(friendship.user2).subscribe(data => {
this.allFriends.push(data);
})
}
});
console.log(this.allFriends);
})
});
} | Connect-HTL-Leonding/Connect | application/application/src/app/pages/meetup-data/meetup-data.page.ts | TypeScript |
MethodDeclaration |
setKeyUser(user) {
} | Connect-HTL-Leonding/Connect | application/application/src/app/pages/meetup-data/meetup-data.page.ts | TypeScript |
MethodDeclaration |
public createMeeting() {
this.time = new Date(this.day);
this.time.setUTCHours(new Date(this.timeOfDay).getHours());
this.time.setUTCMinutes(new Date(this.timeOfDay).getMinutes());
this.time.setUTCSeconds(new Date(this.timeOfDay).getSeconds());
this.meetup = new Meeting(0, this.meetupName, this.time, this.position);
this.ms.createMeetup(this.meetup).subscribe(data=> {
let dataForPost: Array<Object> = new Array();
this.selectedFriends.forEach(friend => {
// The same as Meeting_User in the backend
dataForPost.push({
meeting: data,
user_id: friend.id,
status: "pending",
})
});
this.ms.setOtherUser(dataForPost).subscribe(data=> {
this.contactlistService.contactlistObservable.next("contactListUpdate");
this.ms.createMeetupObservable.next("newMeetup:" + this.selectedRoom.id);
})
this.dismissAll()
})
} | Connect-HTL-Leonding/Connect | application/application/src/app/pages/meetup-data/meetup-data.page.ts | TypeScript |
MethodDeclaration |
async dismissPopover() {
await this.popoverController.dismiss();
} | Connect-HTL-Leonding/Connect | application/application/src/app/pages/meetup-data/meetup-data.page.ts | TypeScript |
MethodDeclaration |
async dismissAll() {
await this.popoverController.dismiss();
this.mp.dismissModal();
} | Connect-HTL-Leonding/Connect | application/application/src/app/pages/meetup-data/meetup-data.page.ts | TypeScript |
MethodDeclaration | /**
* @returns The render root of the footer contents.
*/
private _createFooterRenderRoot() {
const footer = this.ownerDocument!.createElement(`${ddsPrefix}-footer-composite`);
this.parentNode?.insertBefore(footer, this.nextSibling);
return footer;
} | annawen1/carbon-for-ibm-dotcom | packages/web-components/src/components/dotcom-shell/dotcom-shell-composite.ts | TypeScript |
MethodDeclaration | /**
* @returns The render root of the masthead contents.
*/
private _createMastheadRenderRoot() {
const masthead = this.ownerDocument!.createElement(`${ddsPrefix}-masthead-composite`);
this.parentNode?.insertBefore(masthead, this);
return masthead;
} | annawen1/carbon-for-ibm-dotcom | packages/web-components/src/components/dotcom-shell/dotcom-shell-composite.ts | TypeScript |
MethodDeclaration | // eslint-disable-next-line class-methods-use-this
firstUpdated() {
globalInit();
} | annawen1/carbon-for-ibm-dotcom | packages/web-components/src/components/dotcom-shell/dotcom-shell-composite.ts | TypeScript |
MethodDeclaration |
update(changedProperties) {
super.update(changedProperties);
if (!this._mastheadRenderRoot) {
this._mastheadRenderRoot = this._createMastheadRenderRoot();
}
const {
activateSearch,
authenticatedProfileItems,
platform,
platformUrl,
collatorCountryName,
currentSearchResults,
customTypeaheadAPI,
clearSelectionLabel,
disableLocaleButton,
mastheadAssistiveText,
menuBarAssistiveText,
menuButtonAssistiveTextActive,
menuButtonAssistiveTextInactive,
unauthenticatedProfileItems,
inputTimeout,
l1Data,
language,
languageSelectorLabel,
langDisplay,
langList,
legalLinks,
localeList,
footerLinks,
footerSize,
openLocaleModal,
openSearchDropdown,
navLinks,
hasProfile,
hasSearch,
searchPlaceholder,
scopeParameters,
selectedLanguage,
selectedMenuItem,
userStatus,
_setLanguage,
_loadLocaleList,
_loadTranslation,
_loadUserStatus,
_loadSearchResults,
} = this;
Object.assign(
this._mastheadRenderRoot,
pickBy(
{
activateSearch,
authenticatedProfileItems,
platform,
platformUrl,
currentSearchResults,
customTypeaheadAPI,
mastheadAssistiveText,
menuBarAssistiveText,
menuButtonAssistiveTextActive,
menuButtonAssistiveTextInactive,
unauthenticatedProfileItems,
inputTimeout,
l1Data,
language,
navLinks,
hasProfile,
hasSearch,
searchPlaceholder,
scopeParameters,
openSearchDropdown,
selectedMenuItem,
userStatus,
_loadSearchResults,
_loadTranslation,
_loadUserStatus,
_setLanguage,
},
value => value !== undefined
)
);
if (!this._footerRenderRoot) {
this._footerRenderRoot = this._createFooterRenderRoot();
}
Object.assign(
this._footerRenderRoot,
pickBy(
{
clearSelectionLabel,
collatorCountryName,
disableLocaleButton,
language,
languageSelectorLabel,
langDisplay,
langList,
legalLinks,
links: footerLinks,
localeList,
openLocaleModal,
selectedLanguage,
size: footerSize,
_loadLocaleList,
_loadTranslation,
_setLanguage,
},
value => value !== undefined
)
);
} | annawen1/carbon-for-ibm-dotcom | packages/web-components/src/components/dotcom-shell/dotcom-shell-composite.ts | TypeScript |
MethodDeclaration |
updated(changedProperties) {
super.updated(changedProperties);
// moving universal banner outside of dotcom shell if placed within
if (this.querySelector('dds-universal-banner')) {
this.ownerDocument
.querySelector('dds-masthead-composite')
?.before(this.querySelector('dds-universal-banner') as HTMLElement);
}
if (this.ownerDocument.querySelector('dds-universal-banner')) {
this.hasBanner = true;
this._masthead?.setAttribute('with-banner', '');
}
} | annawen1/carbon-for-ibm-dotcom | packages/web-components/src/components/dotcom-shell/dotcom-shell-composite.ts | TypeScript |
MethodDeclaration |
render() {
return html`
<dds-dotcom-shell>
<slot></slot>
</dds-dotcom-shell>
`;
} | annawen1/carbon-for-ibm-dotcom | packages/web-components/src/components/dotcom-shell/dotcom-shell-composite.ts | TypeScript |
ArrowFunction |
async (args) => {
const tests = loadTestCases();
// Polarion Test Case Importer: https://mojo.redhat.com/docs/DOC-1075945
//
// prepare the testcases xml document
const testcases = tests.map((t) => ({
$: { id: t.id },
title: `${t.id} - ${t.category} - ${t.title}`,
description: t.file.link,
"custom-fields": [
{
"custom-field": [
// Level
{ $: { content: "component", id: "caselevel" } },
// Component
{ $: { content: "-", id: "casecomponent" } },
// Test Type
{ $: { content: "functional", id: "testtype" } },
// Subtype 1
{ $: { content: "-", id: "subtype1" } },
// Subtype 2
{ $: { content: "-", id: "subtype2" } },
// Pos/Neg
{ $: { content: "positive", id: "caseposneg" } },
// Importance
{ $: { content: "high", id: "caseimportance" } },
// Automation
{
$: {
content: "automated",
id: "caseautomation",
},
},
],
},
],
}));
const document = {
testcases: {
$: { "project-id": POLARION_PROJECT_ID },
properties: [
{
property: [
{ $: { name: "lookup-method", value: "custom" } },
],
},
],
testcase: testcases,
},
};
await uploadToPolarion(
"testcase",
document,
args.polarionUsername,
args.polarionPassword,
args.dumpOnly
);
} | R-Lawton/integreatly-operator | test-cases/tools/cmd/polarion.ts | TypeScript |
ArrowFunction |
(t) => ({
$: { id: t.id },
title: `${t.id} - ${t.category} - ${t.title}`,
description: t.file.link,
"custom-fields": [
{
"custom-field": [
// Level
{ $: { content: "component", id: "caselevel" } },
// Component
{ $: { content: "-", id: "casecomponent" } },
// Test Type
{ $: { content: "functional", id: "testtype" } },
// Subtype 1
{ $: { content: "-", id: "subtype1" } },
// Subtype 2
{ $: { content: "-", id: "subtype2" } },
// Pos/Neg
{ $: { content: "positive", id: "caseposneg" } },
// Importance
{ $: { content: "high", id: "caseimportance" } },
// Automation
{
$: {
content: "automated",
id: "caseautomation",
},
},
],
},
],
}) | R-Lawton/integreatly-operator | test-cases/tools/cmd/polarion.ts | TypeScript |
ArrowFunction |
async (args) => {
const jira = new Jira(args.jiraUsername, args.jiraPassword);
const epic = await jira.findIssue(args.epic);
assertEpic(epic);
const runs = await loadTestRuns(jira, `"Epic Link" = ${epic.key}`);
const testcases = runs
.filter((r) => r.result !== "Skipped")
.map((r) => {
const testcase: any = {
$: { name: r.title },
properties: {
property: {
$: { name: "polarion-testcase-id", value: r.id },
},
},
};
switch (r.result) {
case "Failed":
testcase.failure = { $: { message: r.link } };
break;
case "Blocked":
testcase.error = { $: { message: r.link } };
break;
case "Passed":
// Do nothing
break;
}
return testcase;
});
const document = {
testsuites: {
properties: {
property: [
{
$: {
name: "polarion-project-id",
value: POLARION_PROJECT_ID,
},
},
{
$: {
name: "polarion-testrun-title",
value: epic.fields.summary,
},
},
{
$: {
name: "polarion-lookup-method",
value: "custom",
},
},
],
},
testsuite: {
$: { tests: 1 },
testcase: testcases,
},
},
};
await uploadToPolarion(
"xunit",
document,
args.polarionUsername,
args.polarionPassword,
args.dumpOnly
);
logger.warn(
"Remember to set the Planned In version to the created Test Run"
);
} | R-Lawton/integreatly-operator | test-cases/tools/cmd/polarion.ts | TypeScript |
ArrowFunction |
(r) => r.result !== "Skipped" | R-Lawton/integreatly-operator | test-cases/tools/cmd/polarion.ts | TypeScript |
ArrowFunction |
(r) => {
const testcase: any = {
$: { name: r.title },
properties: {
property: {
$: { name: "polarion-testcase-id", value: r.id },
},
},
};
switch (r.result) {
case "Failed":
testcase.failure = { $: { message: r.link } };
break;
case "Blocked":
testcase.error = { $: { message: r.link } };
break;
case "Passed":
// Do nothing
break;
}
return testcase;
} | R-Lawton/integreatly-operator | test-cases/tools/cmd/polarion.ts | TypeScript |
ArrowFunction |
(args: Argv): Argv => {
return args.command(testCase).command(testRun);
} | R-Lawton/integreatly-operator | test-cases/tools/cmd/polarion.ts | TypeScript |
ArrowFunction |
() => {
// nothing
} | R-Lawton/integreatly-operator | test-cases/tools/cmd/polarion.ts | TypeScript |
InterfaceDeclaration |
interface TestCaseArgs {
polarionUsername: string;
polarionPassword: string;
dumpOnly: boolean;
} | R-Lawton/integreatly-operator | test-cases/tools/cmd/polarion.ts | TypeScript |
InterfaceDeclaration |
interface TestRunArgs {
polarionUsername: string;
polarionPassword: string;
jiraUsername: string;
jiraPassword: string;
epic: string;
dumpOnly: boolean;
} | R-Lawton/integreatly-operator | test-cases/tools/cmd/polarion.ts | TypeScript |
ClassDeclaration |
@Module({})
export class SharedmodulesModule {} | Prathmesh-codes/BasicNestJS | src/sharedmodules/sharedmodules.module.ts | TypeScript |
ClassDeclaration |
@NgModule({
imports: [CommonModule],
declarations: [
MapTreeViewItemIcon,
MapTreeViewItemName,
MapTreeViewItemOptionButtons,
MapTreeViewLevel,
IsNodeLeafPipe,
MapTreeViewItemIconClassPipe,
MapTreeViewItemIconColorPipe
],
exports: [MapTreeViewLevel]
})
export class MapTreeViewLevelModule {} | MaibornWolff/codecharta | visualization/app/codeCharta/ui/mapTreeView/mapTreeViewLevel.module.ts | TypeScript |
InterfaceDeclaration | /**
* Attach multiple bodies together to interact in unique ways.
* @link [Joint](https://love2d.org/wiki/Joint)
*/
export interface Joint<T extends JointTypes = JointTypes> extends Type<T> {
/**
* Explicitly destroys the Joint. When you don't have time to wait for garbage
* collection, this function may be used to free the object immediately, but note
* that an error will occur if you attempt to use the object after calling this
* function.
*
* @link [Joint:destroy](https://love2d.org/wiki/Joint:destroy)
*/
destroy(): void;
/**
* Get the anchor points of the joint.
*
* @return x1, The x component of the anchor on Body 1.
* @return y1, The y component of the anchor on Body 1.
* @return x2, The x component of the anchor on Body 2.
* @return y2, The y component of the anchor on Body 2.
* @tupleReturn
* @link [Joint:getAnchors](https://love2d.org/wiki/Joint:getAnchors)
*/
getAnchors(): [number, number, number, number];
/**
* Gets the bodies that the Joint is attached to.
*
* @return bodyA, The first Body.
* @return bodyB, The second Body.
* @tupleReturn
* @link [Joint:getBodies](https://love2d.org/wiki/Joint:getBodies)
*/
getBodies(): [Body, Body];
/**
* Gets whether the connected Bodies collide.
*
* @return c, True if they collide, false otherwise.
* @link [Joint:getCollideConnected](https://love2d.org/wiki/Joint:getCollideConnected)
*/
getCollideConnected(): boolean;
/**
* Gets the reaction force on Body 2 at the joint anchor.
*
* @return x, The x component of the force.
* @return y, The y component of the force.
* @tupleReturn
* @link [Joint:getReactionForce](https://love2d.org/wiki/Joint:getReactionForce)
*/
getReactionForce(): [number, number];
/**
* Returns the reaction torque on the second body.
*
* @param invdt How long the force applies. Usually the inverse time step or 1/dt.
* @return torque, The reaction torque on the second body.
* @link [Joint:getReactionTorque](https://love2d.org/wiki/Joint:getReactionTorque)
*/
getReactionTorque(invdt: number): number;
/**
* Gets a string representing the type.
*
* @return type, A string with the name of the Joint type.
* @link [Joint:getType](https://love2d.org/wiki/Joint:getType)
*/
getType(): JointType;
/**
* Returns the Lua value associated with this Joint.
*
* @return value, The Lua value associated with the Joint.
* @link [Joint:getUserData](https://love2d.org/wiki/Joint:getUserData)
*/
getUserData(): any;
/**
* Gets whether the Joint is destroyed. Destroyed joints cannot be used.
*
* @return destroyed, Whether the Joint is destroyed.
* @link [Joint:isDestroyed](https://love2d.org/wiki/Joint:isDestroyed)
*/
isDestroyed(): boolean;
/**
* Associates a Lua value with the Joint.
*
* To delete the reference, explicitly pass _nil/undefined_.
*
* @param value The Lua value to associate with the Joint.
* @link [Joint:setUserData](https://love2d.org/wiki/Joint:setUserData)
*/
setUserData(value: any): void;
} | alihsaas/love-typescript-definitions | typings/love.physics/types/Joint.d.ts | TypeScript |
TypeAliasDeclaration |
export type JointTypes =
| "DistanceJoint"
| "FrictionJoint"
| "GearJoint"
| "MotorJoint"
| "MouseJoint"
| "PrismaticJoint"
| "PulleyJoint"
| "RevoluteJoint"
| "RopeJoint"
| "WeldJoint"
| "WheelJoint"; | alihsaas/love-typescript-definitions | typings/love.physics/types/Joint.d.ts | TypeScript |
ArrowFunction |
element => {
let th = document.createElement('th');
th.scope = "col";
th.textContent = element.name;
th.style.width = element.width;
tr.appendChild(th);
} | veddermatic/PrettyScribe | src/rendererAoS.ts | TypeScript |
TypeAliasDeclaration |
type TableHeaderEntry = {
name: string;
width: string;
}; | veddermatic/PrettyScribe | src/rendererAoS.ts | TypeScript |
MethodDeclaration |
protected createTable(heading: { name: string, width: string }[]): HTMLTableElement {
const table = document.createElement('table');
const thead = document.createElement('thead');
table.appendChild(thead);
thead.classList.add('aos_light');
const tr = document.createElement('tr');
thead.appendChild(tr);
heading.forEach(element => {
let th = document.createElement('th');
th.scope = "col";
th.textContent = element.name;
th.style.width = element.width;
tr.appendChild(th);
});
return table;
} | veddermatic/PrettyScribe | src/rendererAoS.ts | TypeScript |
MethodDeclaration |
private internalKeyword(keyword: string): boolean {
// Internal keywords _not_ all upper case.
const kw_upper = keyword.toUpperCase();
if (kw_upper != keyword) {
return true;
}
return false;
} | veddermatic/PrettyScribe | src/rendererAoS.ts | TypeScript |
MethodDeclaration |
private renderAbilityMap(root: HTMLElement, title: string, abilities: Map<string, string>): void {
let header = document.createElement('h4');
header.textContent = title;
root.appendChild(header);
for (let ability of abilities) {
let a = document.createElement('p');
a.classList.add("aos_font");
a.innerHTML = `<strong>${ability[0]}: </strong>${ability[1]}`;
header.appendChild(a);
}
} | veddermatic/PrettyScribe | src/rendererAoS.ts | TypeScript |
MethodDeclaration |
private renderSpells(root: HTMLElement, spells: AoSSpell[]): void {
const headerInfo = [{ name: "NAME", width: '25%' }, { name: "CASTING VALUE", width: '15%' }, { name: "RANGE", width: '10%' }, { name: "DESCRIPTION", width: '50%' }];
const table = this.createTable(headerInfo);
table.classList.add("table", "table-sm", "aos_font");
let body = document.createElement('tbody');
table.appendChild(body);
for (let spell of spells) {
let tr = document.createElement('tr');
let spellName = document.createElement('td');
spellName.textContent = spell._name;
let value = document.createElement('td');
value.textContent = spell._castingValue.toString();
let range = document.createElement('td');
range.textContent = spell._range.toString();
let desc = document.createElement('td');
desc.textContent = spell._description;
tr.appendChild(spellName);
tr.appendChild(value);
tr.appendChild(range);
tr.appendChild(desc);
body.appendChild(tr);
}
root.appendChild(table);
} | veddermatic/PrettyScribe | src/rendererAoS.ts | TypeScript |
FunctionDeclaration |
declare function ExtrinsicDisplay({ defaultValue, isDisabled, isError, isPrivate, label, onChange, onEnter, onError, onEscape, withLabel }: Props): React.ReactElement<Props>; | UniqueNetwork/unique-ui | dist/react-components/src/Extrinsic.d.ts | TypeScript |
InterfaceDeclaration |
interface Props {
className?: string;
defaultValue: SubmittableExtrinsicFunction<'promise'>;
isDisabled?: boolean;
isError?: boolean;
isPrivate?: boolean;
label?: React.ReactNode;
onChange: (method?: SubmittableExtrinsic<'promise'>) => void;
onEnter?: () => void;
onError?: (error?: Error | null) => void;
onEscape?: () => void;
withLabel?: boolean;
} | UniqueNetwork/unique-ui | dist/react-components/src/Extrinsic.d.ts | TypeScript |
FunctionDeclaration |
export function defaultUserCollection(): UserCollection {
return {
users: [],
page: 0,
pageSize: 1,
totalCount: 0,
} as UserCollection;
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export function isValidUser(user: User): boolean {
return (null != user) && (EmptyUserId != user.id) && ('00000000-0000-0000-0000-000000000000' != user.id);
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export function sortByName(users: User[]): void {
users.sort((first, second) => {
return first.name.toLocaleLowerCase().localeCompare(second.name.toLocaleLowerCase());
});
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function getCurrentUser(): Promise<CurrentUser> {
const result = await RequestHandler.get({
path: 'users/current'
}) as CurrentUser;
UserCache.process(result.user);
return result;
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function getUsers(request: GetUsersRequest): Promise<UserCollection> {
const result = await RequestHandler.get({
path: 'users',
query: request
}) as UserCollection;
UserCache.processCollection(result);
return result;
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function getUserByName(name: string): Promise<User> {
const result = (await RequestHandler.get({
path: 'users/name/' + encodeURIComponent(name)
}) as SingleUser).user;
UserCache.process(result);
return result;
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function getUsersSubscribedToThread(threadId: string): Promise<User[]> {
const collection = (await RequestHandler.get({
path: 'users/subscribed/thread/' + encodeURIComponent(threadId)
}) as UserCollection);
collection.users = collection.users || [];
UserRepository.sortByName(collection.users);
UserCache.processCollection(collection);
return collection.users;
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function getOnlineUsers(): Promise<User[]> {
const result = (await RequestHandler.get({
path: 'users/online',
}) as OnlineUserCollection).online_users || [];
UserCache.processUsers(result);
return result;
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function getMultipleById(ids: string[]): Promise<string[]> {
return (await RequestHandler.get({
path: 'users/multiple/ids/' + encodeURIComponent(ids.join(','))
})).users;
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function getMultipleByName(names: string[]): Promise<string[]> {
return (await RequestHandler.get({
path: 'users/multiple/names/' + encodeURIComponent(names.join(','))
})).user_ids;
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function createUserName(name: string): Promise<void> {
await RequestHandler.post({
path: 'users',
stringData: name
});
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function editUserName(userId: string, newName: string): Promise<void> {
await RequestHandler.put({
path: 'users/name/' + encodeURIComponent(userId),
stringData: newName
});
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function editUserInfo(userId: string, newInfo: string): Promise<void> {
await RequestHandler.put({
path: 'users/info/' + encodeURIComponent(userId),
stringData: newInfo
});
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function editUserTitle(userId: string, newTitle: string): Promise<void> {
await RequestHandler.put({
path: 'users/title/' + encodeURIComponent(userId),
stringData: newTitle
});
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function editUserSignature(userId: string, newSignature: string): Promise<void> {
await RequestHandler.put({
path: 'users/signature/' + encodeURIComponent(userId),
stringData: newSignature
});
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function editUserAttachmentQuota(userId: string, newQuota: number): Promise<void> {
await RequestHandler.put({
path: 'users/attachment_quota/' + encodeURIComponent(userId) + '/' + encodeURIComponent(newQuota.toString())
});
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function deleteUserLogo(userId: string): Promise<void> {
await RequestHandler.requestDelete({
path: 'users/logo/' + encodeURIComponent(userId)
});
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function editUserLogo(userId: string, fileContent: ArrayBuffer): Promise<void> {
await RequestHandler.put({
path: 'users/logo/' + encodeURIComponent(userId),
binaryData: fileContent
});
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function deleteUser(userId: string): Promise<void> {
await RequestHandler.requestDelete({
path: 'users/' + encodeURIComponent(userId)
});
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function searchUsersByName(name: string): Promise<User[]> {
if (name && name.length) {
const searchResult = await RequestHandler.get({
path: 'users/search/' + encodeURIComponent(name),
query: {}
}) as UserSearchResult;
const pageNumber = Math.floor(searchResult.index / searchResult.pageSize);
const firstIndexInPage = pageNumber * searchResult.pageSize;
const collectionPromises: Promise<UserCollection>[] = [
getUsers({
page: pageNumber,
orderBy: 'name',
sort: 'ascending'
})
];
if (pageNumber != firstIndexInPage) {
collectionPromises.push(getUsers({
page: pageNumber + 1,
orderBy: 'name',
sort: 'ascending'
}));
} else {
collectionPromises.push(Promise.resolve(defaultUserCollection()));
}
const collections = await Promise.all(collectionPromises);
let users = collections[0].users.slice(searchResult.index - firstIndexInPage);
const remaining = searchResult.pageSize - users.length;
if (remaining > 0) {
users = users.concat(collections[1].users.slice(0, remaining));
}
return users;
}
return Promise.resolve([]);
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function getReceivedVotesHistory(): Promise<VoteHistory> {
return await RequestHandler.get({
path: 'users/votehistory'
}) as VoteHistory;
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |
FunctionDeclaration |
export async function getQuotedHistory(): Promise<QuoteHistory> {
const result = await RequestHandler.get({
path: 'users/quotedhistory'
}) as QuoteHistory;
UserCache.processMessages(result.messages);
return result;
} | danij/Forum.WebClient | src/services/userRepository.ts | TypeScript |