type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
|---|---|---|---|---|
InterfaceDeclaration
|
export interface Storage {
_id: string;
name: string;
remark: string;
}
|
Aralhi/RepairMan
|
client/app/models/storage.ts
|
TypeScript
|
ClassDeclaration
|
export class Main {
public useTcpPort: number;
constructor() {
this.useTcpPort = 43859;
this.parseArgs();
}
parseArgs() {
throw new Error('Method not implemented.');
}
start() {
throw new Error('Method not implemented.');
}
}
|
haneefdm/cortex-debug-proxy
|
src/main.ts
|
TypeScript
|
MethodDeclaration
|
parseArgs() {
throw new Error('Method not implemented.');
}
|
haneefdm/cortex-debug-proxy
|
src/main.ts
|
TypeScript
|
MethodDeclaration
|
start() {
throw new Error('Method not implemented.');
}
|
haneefdm/cortex-debug-proxy
|
src/main.ts
|
TypeScript
|
ArrowFunction
|
(props) => {
const { color, size, ...otherProps } = props;
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={size}
height={size}
viewBox="0 0 24 24"
fill="none"
stroke={color}
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
{...otherProps}
>
<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"></path>
</svg>
|
anythingcodes/canvas-framer
|
src/code/icons/phone.tsx
|
TypeScript
|
ClassDeclaration
|
export class BaseRepo extends RootClass {
protected db: Kmore<DbModel>
@Init()
async init(): Promise<void> {
/* c8 ignore next 3 */
if (! this.ctx) {
this.throwError('Value of this.ctx is undefined during Repo init')
}
if (! this.ctx.dbTransactions || this.ctx.dbTransactions.size) {
this.ctx.dbTransactions = new Set()
}
const container = this.app.getApplicationContext()
const dbManager = await container.getAsync(DbManager) as DbManager<DbReplicaKeys>
this.db = await dbManager.create<DbModel>(this.ctx, DbReplica.master, unsubscribeEventFuncOnResFinish)
}
/**
* Start and return a db transacton
* @description using `this.db.dbh` if param dbhInstance undefined
*/
async startTransaction(dbhInstance?: Knex): Promise<DbTransaction> {
const dbh = dbhInstance ?? this.db.dbh
/* c8 ignore next 3 */
if (! dbh) {
this.throwError('dbh undefined', 999)
}
try {
const ret = await dbh.transaction()
this.ctx.dbTransactions.add(ret)
return ret
}
/* c8 ignore next 4 */
catch (ex) {
this.logger.error((ex as Error).message)
this.throwError('start transaction failed', 999)
}
}
}
|
waitingsong/midway-mono-base
|
packages/demo-service/src/core/base.repo.ts
|
TypeScript
|
MethodDeclaration
|
@Init()
async init(): Promise<void> {
/* c8 ignore next 3 */
if (! this.ctx) {
this.throwError('Value of this.ctx is undefined during Repo init')
}
if (! this.ctx.dbTransactions || this.ctx.dbTransactions.size) {
this.ctx.dbTransactions = new Set()
}
const container = this.app.getApplicationContext()
const dbManager = await container.getAsync(DbManager) as DbManager<DbReplicaKeys>
this.db = await dbManager.create<DbModel>(this.ctx, DbReplica.master, unsubscribeEventFuncOnResFinish)
}
|
waitingsong/midway-mono-base
|
packages/demo-service/src/core/base.repo.ts
|
TypeScript
|
MethodDeclaration
|
/**
* Start and return a db transacton
* @description using `this.db.dbh` if param dbhInstance undefined
*/
async startTransaction(dbhInstance?: Knex): Promise<DbTransaction> {
const dbh = dbhInstance ?? this.db.dbh
/* c8 ignore next 3 */
if (! dbh) {
this.throwError('dbh undefined', 999)
}
try {
const ret = await dbh.transaction()
this.ctx.dbTransactions.add(ret)
return ret
}
/* c8 ignore next 4 */
catch (ex) {
this.logger.error((ex as Error).message)
this.throwError('start transaction failed', 999)
}
}
|
waitingsong/midway-mono-base
|
packages/demo-service/src/core/base.repo.ts
|
TypeScript
|
FunctionDeclaration
|
export function configureDatabase() {
mongoose.connect(
// tslint:disable-next-line:max-line-length
environment.db.mongoUri,
{ dbName: 'test' }).then(() => {
console.log('Connection to the Atlas Cluster is successful!')
})
.catch((err) => {
console.error(err)
console.error('Make sure your IP has been whitelisted!')
})
}
|
jwoodmansey/safarnama
|
src/express/configureDatabase.ts
|
TypeScript
|
ArrowFunction
|
() => {
console.log('Connection to the Atlas Cluster is successful!')
}
|
jwoodmansey/safarnama
|
src/express/configureDatabase.ts
|
TypeScript
|
ArrowFunction
|
(err) => {
console.error(err)
console.error('Make sure your IP has been whitelisted!')
}
|
jwoodmansey/safarnama
|
src/express/configureDatabase.ts
|
TypeScript
|
ArrowFunction
|
(text: string | number): string | number => {
return `\u001B[1m${text}\u001B[0m`;
}
|
Lulzx/code-server
|
packages/server/src/cli.ts
|
TypeScript
|
ArrowFunction
|
(arg, i) => {
// [0] contains the binary running the script (`node` for example) and
// [1] contains the script name, so the arguments come after that.
process.argv[i + 2] = arg;
}
|
Lulzx/code-server
|
packages/server/src/cli.ts
|
TypeScript
|
ArrowFunction
|
(socket: WebSocket): void => {
const active = new SharedProcessActive();
active.setSocketPath(sharedProcess.socketPath);
active.setLogPath(logDir);
const serverMessage = new ServerMessage();
serverMessage.setSharedProcessActive(active);
socket.send(serverMessage.serializeBinary());
}
|
Lulzx/code-server
|
packages/server/src/cli.ts
|
TypeScript
|
ArrowFunction
|
(event) => {
if (event.state === SharedProcessState.Ready) {
app.wss.clients.forEach((c) => sendSharedProcessReady(c));
}
}
|
Lulzx/code-server
|
packages/server/src/cli.ts
|
TypeScript
|
ArrowFunction
|
(c) => sendSharedProcessReady(c)
|
Lulzx/code-server
|
packages/server/src/cli.ts
|
TypeScript
|
ArrowFunction
|
(app): void => {
app.use((req, res, next) => {
res.on("finish", () => {
logger.trace(`\u001B[1m${req.method} ${res.statusCode} \u001B[0m${req.url}`, field("host", req.hostname), field("ip", req.ip));
});
next();
});
// If we're not running from the binary and we aren't serving the static
// pre-built version, use webpack to serve the web files.
if (!isCli && !serveStatic) {
const webpackConfig = require(path.resolve(__dirname, "..", "..", "web", "webpack.config.js"));
const compiler = require("webpack")(webpackConfig);
app.use(require("webpack-dev-middleware")(compiler, {
logger,
publicPath: webpackConfig.output.publicPath,
stats: webpackConfig.stats,
}));
app.use(require("webpack-hot-middleware")(compiler));
}
}
|
Lulzx/code-server
|
packages/server/src/cli.ts
|
TypeScript
|
ArrowFunction
|
(req, res, next) => {
res.on("finish", () => {
logger.trace(`\u001B[1m${req.method} ${res.statusCode} \u001B[0m${req.url}`, field("host", req.hostname), field("ip", req.ip));
});
next();
}
|
Lulzx/code-server
|
packages/server/src/cli.ts
|
TypeScript
|
ArrowFunction
|
() => {
logger.trace(`\u001B[1m${req.method} ${res.statusCode} \u001B[0m${req.url}`, field("host", req.hostname), field("ip", req.ip));
}
|
Lulzx/code-server
|
packages/server/src/cli.ts
|
TypeScript
|
ArrowFunction
|
(modulePath: string, args?: string[], options?: ForkOptions): ChildProcess => {
if (options && options.env && options.env.AMD_ENTRYPOINT) {
return forkModule(options.env.AMD_ENTRYPOINT, args, options, dataDir);
}
if (isCli) {
return spawn(process.execPath, [path.join(buildDir, "out", "cli.js"), "--fork", modulePath, "--extra-args", JSON.stringify(args), "--data-dir", dataDir], {
...options,
stdio: [null, null, null, "ipc"],
});
} else {
return fork(modulePath, args, options);
}
}
|
Lulzx/code-server
|
packages/server/src/cli.ts
|
TypeScript
|
ArrowFunction
|
(ws, req) => {
const id = clientId++;
if (sharedProcess.state === SharedProcessState.Ready) {
sendSharedProcessReady(ws);
}
logger.info(`WebSocket opened \u001B[0m${req.url}`, field("client", id), field("ip", req.socket.remoteAddress));
ws.on("close", (code) => {
logger.info(`WebSocket closed \u001B[0m${req.url}`, field("client", id), field("code", code));
});
}
|
Lulzx/code-server
|
packages/server/src/cli.ts
|
TypeScript
|
ArrowFunction
|
(code) => {
logger.info(`WebSocket closed \u001B[0m${req.url}`, field("client", id), field("code", code));
}
|
Lulzx/code-server
|
packages/server/src/cli.ts
|
TypeScript
|
ArrowFunction
|
(err: NodeJS.ErrnoException) => {
if (err.code === "EADDRINUSE") {
logger.error(`Port ${bold(options.port)} is in use. Please free up port ${options.port} or specify a different port with the -p flag`);
process.exit(1);
}
}
|
Lulzx/code-server
|
packages/server/src/cli.ts
|
TypeScript
|
ArrowFunction
|
(ex) => {
logger.error(ex);
}
|
Lulzx/code-server
|
packages/server/src/cli.ts
|
TypeScript
|
FunctionDeclaration
|
export function updateDependencies(tree: Tree, schema: Schema) {
let devDependencies = {
'svelte-jester': '^1.3.2',
svelte: '^3.42.1',
'svelte-check': '^1.4.0',
'svelte-preprocess': '^4.7.4',
'@tsconfig/svelte': '^1.0.10',
'@testing-library/svelte': '^3.0.3',
'rollup-plugin-local-resolve': '^1.0.7',
};
if(schema?.bundler === 'vite') {
devDependencies = {
...devDependencies,
...{'@sveltejs/vite-plugin-svelte': '^1.0.0-next.10'}
};
}
return addDependenciesToPackageJson(
tree,
{},
devDependencies
);
}
|
JoMen6/nx-extensions
|
packages/svelte/src/generators/init/lib/add-dependencies.ts
|
TypeScript
|
ClassDeclaration
|
@NgModule({
imports: [
CommonModule,
RouterModule.forChild(routes),
AccordionControlModule.forRoot(),
MaterialPreviewModule,
PartialsModule,
CoreModule,
FormsModule,
ReactiveFormsModule,
MatInputModule,
MatFormFieldModule,
MatDatepickerModule,
MatAutocompleteModule,
MatListModule,
MatSliderModule,
MatCardModule,
MatSelectModule,
MatButtonModule,
MatIconModule,
MatNativeDateModule,
MatSlideToggleModule,
MatCheckboxModule,
MatMenuModule,
MatTabsModule,
MatTooltipModule,
MatSidenavModule,
MatProgressBarModule,
MatProgressSpinnerModule,
MatSnackBarModule,
MatTableModule,
MatGridListModule,
MatToolbarModule,
MatExpansionModule,
MatDividerModule,
MatSortModule,
MatStepperModule,
MatChipsModule,
MatPaginatorModule,
MatDialogModule,
MatRadioModule
],
exports: [RouterModule],
entryComponents: [
],
providers: [MatIconRegistry],
declarations: [
MetronicComponent,
AccordionComponent,
StickyFormActionsComponent,
FormsComponent,
]
})
export class MetronicModule { }
|
duberg/annette-sphera
|
annette-frontend-sphera/ng/src/app/content/pages/components/metronic/metronic.module.ts
|
TypeScript
|
ClassDeclaration
|
export class App extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {satisfactionLevel: 300};
}
public render() {
return (
<div>
<input type="range"
min="0"
max="500"
value={this.state.satisfactionLevel}
onChange={(event : any) => this.setState({satisfactionLevel :event.target.value} as State)}
|
Lemoncode/react-by-sample
|
13_ShouldUpdate/src/app.tsx
|
TypeScript
|
InterfaceDeclaration
|
interface Props {
}
|
Lemoncode/react-by-sample
|
13_ShouldUpdate/src/app.tsx
|
TypeScript
|
InterfaceDeclaration
|
interface State {
satisfactionLevel : number;
}
|
Lemoncode/react-by-sample
|
13_ShouldUpdate/src/app.tsx
|
TypeScript
|
MethodDeclaration
|
public render() {
return (
<div>
<input type="range"
min="0"
max="500"
value={this.state.satisfactionLevel}
onChange={(event : any) => this.setState({satisfactionLevel :event.target.value} as State)}
|
Lemoncode/react-by-sample
|
13_ShouldUpdate/src/app.tsx
|
TypeScript
|
ArrowFunction
|
() => {
this.container.innerHTML = isEmpty ? '' : this.render()
}
|
nbili/ui-component-oop
|
src/code/Spin.ts
|
TypeScript
|
ClassDeclaration
|
class Spin {
container: HTMLElement
options: Partial<Options>
size: Options['size']
delay: Options['delay']
spinning: Options['spinning']
constructor(el: HTMLElement | string, options?: Partial<Options>) {
this.container = getElement(el)
this.options = Object.assign({ delay: 0, size: 'default', spinning: true }, options)
this.size = this.options.size
this.delay = this.options.delay
this.spinning = this.options.spinning
this.toRender()
}
show() {
this.toRender()
this.spinning = true
}
hide() {
this.toRender(true)
this.spinning = false
}
toRender(isEmpty = false) {
if (this.delay) {
setTimeout(() => {
this.container.innerHTML = isEmpty ? '' : this.render()
}, this.delay);
} else {
this.container.innerHTML = isEmpty ? '' : this.render()
}
}
render() {
let size = this.size
return `
<div class="spin-spinning ${size === 'large' ? 'spin-lg' : 'spin'}">
<span class="spin-dot spin-to-spin">
<i class="spin-dot__item"></i>
<i class="spin-dot__item"></i>
<i class="spin-dot__item"></i>
<i class="spin-dot__item"></i>
</span>
</div>
`
}
}
|
nbili/ui-component-oop
|
src/code/Spin.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type Options = {
delay: number
size: 'default' | 'large'
spinning: boolean
}
|
nbili/ui-component-oop
|
src/code/Spin.ts
|
TypeScript
|
MethodDeclaration
|
show() {
this.toRender()
this.spinning = true
}
|
nbili/ui-component-oop
|
src/code/Spin.ts
|
TypeScript
|
MethodDeclaration
|
hide() {
this.toRender(true)
this.spinning = false
}
|
nbili/ui-component-oop
|
src/code/Spin.ts
|
TypeScript
|
MethodDeclaration
|
toRender(isEmpty = false) {
if (this.delay) {
setTimeout(() => {
this.container.innerHTML = isEmpty ? '' : this.render()
}, this.delay);
} else {
this.container.innerHTML = isEmpty ? '' : this.render()
}
}
|
nbili/ui-component-oop
|
src/code/Spin.ts
|
TypeScript
|
MethodDeclaration
|
render() {
let size = this.size
return `
<div class="spin-spinning ${size === 'large' ? 'spin-lg' : 'spin'}">
<span class="spin-dot spin-to-spin">
<i class="spin-dot__item"></i>
<i class="spin-dot__item"></i>
<i class="spin-dot__item"></i>
<i class="spin-dot__item"></i>
</span>
</div>
`
}
|
nbili/ui-component-oop
|
src/code/Spin.ts
|
TypeScript
|
FunctionDeclaration
|
/**
* isRef
* @param obj value
*/
export function isRef<T>(obj: any): obj is Ref<T> {
return obj instanceof RefImpl;
}
|
aceHubert/ace-vue
|
packages/acevue-hooks/src/apis/ref.ts
|
TypeScript
|
FunctionDeclaration
|
/**
* createRef
* @param options get/set
*/
export function createRef<T>(options: RefOption<T>): RefObject<T> {
const vm = ensureCurrentVM('createRef');
const id = getCallId();
const store = (vm._refsStore = vm._refsStore || {});
// seal the ref, this could prevent ref from being observed
// It's safe to seal the ref, since we really shoulnd't extend it.
return isMounting() ? (store[id] = Object.seal(new RefImpl<T>(options))) : store[id];
}
|
aceHubert/ace-vue
|
packages/acevue-hooks/src/apis/ref.ts
|
TypeScript
|
FunctionDeclaration
|
/**
* overload 1: for potentially undefined initialValue / call with 0 arguments
*/
export function useRef<T extends unknown = undefined>(): MutableRefObject<T | undefined>;
|
aceHubert/ace-vue
|
packages/acevue-hooks/src/apis/ref.ts
|
TypeScript
|
FunctionDeclaration
|
/**
* overload 2: returns a mutable ref object whose `.current` property is initialized to the passed argument "initialValue"
* @param initialValue initial value
*/
export function useRef<T extends unknown>(initialValue: T): MutableRefObject<T>;
|
aceHubert/ace-vue
|
packages/acevue-hooks/src/apis/ref.ts
|
TypeScript
|
FunctionDeclaration
|
/**
* overload 3: for refs given as a ref prop as they typically start with a null value
* @param initialValue initial value
*/
export function useRef<T>(initialValue: T | null): RefObject<T>;
|
aceHubert/ace-vue
|
packages/acevue-hooks/src/apis/ref.ts
|
TypeScript
|
FunctionDeclaration
|
/**
* implementation
*/
export function useRef<T>(initialValue?: T): MutableRefObject<T> | RefObject<T> {
const vm = ensureCurrentVM('useRef');
const id = getCallId();
const store = (vm._refsStore = vm._refsStore || {});
if (isMounting()) {
store[id] = initialValue;
}
return createRef({
get: () => store[id],
set: val => (store[id] = val),
});
}
|
aceHubert/ace-vue
|
packages/acevue-hooks/src/apis/ref.ts
|
TypeScript
|
ArrowFunction
|
() => store[id]
|
aceHubert/ace-vue
|
packages/acevue-hooks/src/apis/ref.ts
|
TypeScript
|
ArrowFunction
|
val => (store[id] = val)
|
aceHubert/ace-vue
|
packages/acevue-hooks/src/apis/ref.ts
|
TypeScript
|
ClassDeclaration
|
class RefImpl<T> implements RefObject<T> {
public current!: T;
constructor({ get, set }: RefOption<T>) {
proxy(this, 'current', {
get,
set,
});
}
}
|
aceHubert/ace-vue
|
packages/acevue-hooks/src/apis/ref.ts
|
TypeScript
|
ArrowFunction
|
current => current === name
|
ArtMajMarviq/Intershop
|
src/app/extensions/tacton/pages/configure/tacton-configure-navigation/tacton-configure-navigation.component.ts
|
TypeScript
|
ClassDeclaration
|
@Component({
selector: 'ish-tacton-configure-navigation',
templateUrl: './tacton-configure-navigation.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TactonConfigureNavigationComponent implements OnInit {
tree$: Observable<TactonNavigationTree>;
constructor(private tactonFacade: TactonFacade) {}
ngOnInit() {
this.tree$ = this.tactonFacade.configurationTree$;
}
changeStep(step: string) {
this.tactonFacade.changeConfigurationStep(step);
}
/**
* scroll anchor smoothly into view
* @see https://stackoverflow.com/questions/46658522/how-to-smooth-scroll-to-page-anchor-in-angular-4-without-plugins-properly/51400379#51400379
*/
scrollIntoView(id: string) {
document.querySelector(`#anchor-${id}`)?.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' });
}
isActive$(name: string) {
return this.tactonFacade.currentGroup$.pipe(map(current => current === name));
}
}
|
ArtMajMarviq/Intershop
|
src/app/extensions/tacton/pages/configure/tacton-configure-navigation/tacton-configure-navigation.component.ts
|
TypeScript
|
MethodDeclaration
|
ngOnInit() {
this.tree$ = this.tactonFacade.configurationTree$;
}
|
ArtMajMarviq/Intershop
|
src/app/extensions/tacton/pages/configure/tacton-configure-navigation/tacton-configure-navigation.component.ts
|
TypeScript
|
MethodDeclaration
|
changeStep(step: string) {
this.tactonFacade.changeConfigurationStep(step);
}
|
ArtMajMarviq/Intershop
|
src/app/extensions/tacton/pages/configure/tacton-configure-navigation/tacton-configure-navigation.component.ts
|
TypeScript
|
MethodDeclaration
|
/**
* scroll anchor smoothly into view
* @see https://stackoverflow.com/questions/46658522/how-to-smooth-scroll-to-page-anchor-in-angular-4-without-plugins-properly/51400379#51400379
*/
scrollIntoView(id: string) {
document.querySelector(`#anchor-${id}`)?.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' });
}
|
ArtMajMarviq/Intershop
|
src/app/extensions/tacton/pages/configure/tacton-configure-navigation/tacton-configure-navigation.component.ts
|
TypeScript
|
MethodDeclaration
|
isActive$(name: string) {
return this.tactonFacade.currentGroup$.pipe(map(current => current === name));
}
|
ArtMajMarviq/Intershop
|
src/app/extensions/tacton/pages/configure/tacton-configure-navigation/tacton-configure-navigation.component.ts
|
TypeScript
|
ArrowFunction
|
() => RoleAndPermession
|
foaudkajj/telegram-siparis-botu
|
src/DB/models/Role.ts
|
TypeScript
|
ArrowFunction
|
roleAndPermession => roleAndPermession.Role
|
foaudkajj/telegram-siparis-botu
|
src/DB/models/Role.ts
|
TypeScript
|
ArrowFunction
|
() => User
|
foaudkajj/telegram-siparis-botu
|
src/DB/models/Role.ts
|
TypeScript
|
ArrowFunction
|
pnaleUser => pnaleUser.Role
|
foaudkajj/telegram-siparis-botu
|
src/DB/models/Role.ts
|
TypeScript
|
ClassDeclaration
|
@Entity()
export class Role {
@PrimaryGeneratedColumn()
Id: number;
@Column()
RoleName: string;
@Column({ nullable: true })
Description: string;
@OneToMany(() => RoleAndPermession, roleAndPermession => roleAndPermession.Role)
RoleAndPermessions: RoleAndPermession[];
@OneToMany(() => User, pnaleUser => pnaleUser.Role)
Users: User[];
}
|
foaudkajj/telegram-siparis-botu
|
src/DB/models/Role.ts
|
TypeScript
|
ArrowFunction
|
(recordedActions: Action[]): Middleware =>
() => (next) => (action) => {
recordedActions.push(action);
return next(action);
}
|
0xblack/try
|
Microsoft.DotNet.Try.Client/test/ActionRecorderMiddleware.ts
|
TypeScript
|
ArrowFunction
|
() => (next) => (action) => {
recordedActions.push(action);
return next(action);
}
|
0xblack/try
|
Microsoft.DotNet.Try.Client/test/ActionRecorderMiddleware.ts
|
TypeScript
|
ArrowFunction
|
(next) => (action) => {
recordedActions.push(action);
return next(action);
}
|
0xblack/try
|
Microsoft.DotNet.Try.Client/test/ActionRecorderMiddleware.ts
|
TypeScript
|
ArrowFunction
|
(action) => {
recordedActions.push(action);
return next(action);
}
|
0xblack/try
|
Microsoft.DotNet.Try.Client/test/ActionRecorderMiddleware.ts
|
TypeScript
|
ClassDeclaration
|
export default class PhoneInput extends React.Component<PhoneInputProps> {}
|
ThreadsStyling/react-native-phone-input
|
lib/index.d.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface PhoneInputProps {
initialCountry?: string;
allowZeroAfterCountryCode?: boolean;
disabled?: boolean;
value?: string | null;
style?: any;
flagStyle?: object;
textStyle?: object;
textProps?: TextInputProps;
textComponent?: React.ComponentType;
offset?: number;
pickerButtonColor?: string;
pickerBackgroundColor?: string;
pickerItemStyle?: object;
cancelText?: string;
confirmText?: string;
buttonTextStyle?: object;
onChangePhoneNumber?: (phoneNumber: string) => void;
onSelectCountry?: (iso2: string) => void;
onPressFlag?: () => void;
countriesList?: string[];
}
|
ThreadsStyling/react-native-phone-input
|
lib/index.d.ts
|
TypeScript
|
ArrowFunction
|
(logger: Logger): IMiddleware => {
return async (ctx: Context, next: () => Promise<unknown>) => {
const start = Date.now();
await next();
const message = `[${ctx.status}] ${ctx.method} ${ctx.path}`;
const logData: LogData = {
method: ctx.method,
path: ctx.path,
statusCode: ctx.status,
timeMs: Date.now() - start
};
if (ctx.status >= 400) {
logger.error(message, logData, ctx.body);
} else {
logger.info(message, logData);
}
};
}
|
alphabitdev/Node-TypeScript-Koa-TypeOrm-API-Boilerplate
|
src/server/middleware/log-request.ts
|
TypeScript
|
ArrowFunction
|
async (ctx: Context, next: () => Promise<unknown>) => {
const start = Date.now();
await next();
const message = `[${ctx.status}] ${ctx.method} ${ctx.path}`;
const logData: LogData = {
method: ctx.method,
path: ctx.path,
statusCode: ctx.status,
timeMs: Date.now() - start
};
if (ctx.status >= 400) {
logger.error(message, logData, ctx.body);
} else {
logger.info(message, logData);
}
}
|
alphabitdev/Node-TypeScript-Koa-TypeOrm-API-Boilerplate
|
src/server/middleware/log-request.ts
|
TypeScript
|
InterfaceDeclaration
|
interface LogData {
method: string;
path: string;
statusCode: number;
timeMs: number;
}
|
alphabitdev/Node-TypeScript-Koa-TypeOrm-API-Boilerplate
|
src/server/middleware/log-request.ts
|
TypeScript
|
ArrowFunction
|
(option) => html` <paper-item>${option}</paper-item> `
|
cornim/frontend
|
src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts
|
TypeScript
|
ClassDeclaration
|
@customElement("hui-input-select-entity-row")
class HuiInputSelectEntityRow extends LitElement implements LovelaceRow {
@property({ attribute: false }) public hass?: HomeAssistant;
@internalProperty() private _config?: EntitiesCardEntityConfig;
public setConfig(config: EntitiesCardEntityConfig): void {
if (!config || !config.entity) {
throw new Error("Entity must be specified");
}
this._config = config;
}
protected shouldUpdate(changedProps: PropertyValues): boolean {
return hasConfigOrEntityChanged(this, changedProps);
}
protected render(): TemplateResult {
if (!this.hass || !this._config) {
return html``;
}
const stateObj = this.hass.states[this._config.entity] as
| InputSelectEntity
| undefined;
if (!stateObj) {
return html`
<hui-warning>
${createEntityNotFoundWarning(this.hass, this._config.entity)}
</hui-warning>
`;
}
const pointer =
(this._config.tap_action && this._config.tap_action.action !== "none") ||
(this._config.entity &&
!DOMAINS_HIDE_MORE_INFO.includes(computeDomain(this._config.entity)));
return html`
<state-badge
.stateObj=${stateObj}
.stateColor=${this._config.state_color}
.overrideIcon=${this._config.icon}
.overrideImage=${this._config.image}
class=${classMap({
pointer,
})}
@action=${this._handleAction}
.actionHandler=${actionHandler({
hasHold: hasAction(this._config!.hold_action),
hasDoubleClick: hasAction(this._config!.double_tap_action),
})}
tabindex=${ifDefined(pointer ? "0" : undefined)}
></state-badge>
<ha-paper-dropdown-menu
.label=${this._config.name || computeStateName(stateObj)}
.value=${stateObj.state}
.disabled=${UNAVAILABLE_STATES.includes(stateObj.state)}
@iron-select=${this._selectedChanged}
@click=${stopPropagation}
>
<paper-listbox slot="dropdown-content">
${stateObj.attributes.options
? stateObj.attributes.options.map(
(option) => html` <paper-item>${option}</paper-item> `
)
: ""}
</paper-listbox>
</ha-paper-dropdown-menu>
`;
}
protected updated(changedProps: PropertyValues) {
super.updated(changedProps);
if (!this.hass || !this._config) {
return;
}
const stateObj = this.hass.states[this._config.entity] as
| InputSelectEntity
| undefined;
if (!stateObj) {
return;
}
// Update selected after rendering the items or else it won't work in Firefox
if (stateObj.attributes.options) {
this.shadowRoot!.querySelector(
"paper-listbox"
)!.selected = stateObj.attributes.options.indexOf(stateObj.state);
}
}
private _handleAction(ev: ActionHandlerEvent) {
handleAction(this, this.hass!, this._config!, ev.detail.action!);
}
static get styles(): CSSResult {
return css`
:host {
display: flex;
align-items: center;
}
ha-paper-dropdown-menu {
margin-left: 16px;
flex: 1;
}
paper-item {
cursor: pointer;
min-width: 200px;
}
.pointer {
cursor: pointer;
}
state-badge:focus {
outline: none;
background: var(--divider-color);
border-radius: 100%;
}
`;
}
private _selectedChanged(ev): void {
const stateObj = this.hass!.states[this._config!.entity];
const option = ev.target.selectedItem.innerText.trim();
if (option === stateObj.state) {
return;
}
forwardHaptic("light");
setInputSelectOption(this.hass!, stateObj.entity_id, option);
}
}
|
cornim/frontend
|
src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts
|
TypeScript
|
InterfaceDeclaration
|
interface HTMLElementTagNameMap {
"hui-input-select-entity-row": HuiInputSelectEntityRow;
}
|
cornim/frontend
|
src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts
|
TypeScript
|
MethodDeclaration
|
public setConfig(config: EntitiesCardEntityConfig): void {
if (!config || !config.entity) {
throw new Error("Entity must be specified");
}
this._config = config;
}
|
cornim/frontend
|
src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts
|
TypeScript
|
MethodDeclaration
|
protected shouldUpdate(changedProps: PropertyValues): boolean {
return hasConfigOrEntityChanged(this, changedProps);
}
|
cornim/frontend
|
src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts
|
TypeScript
|
MethodDeclaration
|
protected render(): TemplateResult {
if (!this.hass || !this._config) {
return html``;
}
const stateObj = this.hass.states[this._config.entity] as
| InputSelectEntity
| undefined;
if (!stateObj) {
return html`
<hui-warning>
${createEntityNotFoundWarning(this.hass, this._config.entity)}
</hui-warning>
`;
}
const pointer =
(this._config.tap_action && this._config.tap_action.action !== "none") ||
(this._config.entity &&
!DOMAINS_HIDE_MORE_INFO.includes(computeDomain(this._config.entity)));
return html`
<state-badge
.stateObj=${stateObj}
.stateColor=${this._config.state_color}
.overrideIcon=${this._config.icon}
.overrideImage=${this._config.image}
class=${classMap({
pointer,
})}
@action=${this._handleAction}
.actionHandler=${actionHandler({
hasHold: hasAction(this._config!.hold_action),
hasDoubleClick: hasAction(this._config!.double_tap_action),
})}
tabindex=${ifDefined(pointer ? "0" : undefined)}
></state-badge>
<ha-paper-dropdown-menu
.label=${this._config.name || computeStateName(stateObj)}
.value=${stateObj.state}
.disabled=${UNAVAILABLE_STATES.includes(stateObj.state)}
@iron-select=${this._selectedChanged}
@click=${stopPropagation}
>
<paper-listbox slot="dropdown-content">
${stateObj.attributes.options
? stateObj.attributes.options.map(
(option) => html` <paper-item>${option}</paper-item> `
)
: ""}
</paper-listbox>
</ha-paper-dropdown-menu>
`;
}
|
cornim/frontend
|
src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts
|
TypeScript
|
MethodDeclaration
|
protected updated(changedProps: PropertyValues) {
super.updated(changedProps);
if (!this.hass || !this._config) {
return;
}
const stateObj = this.hass.states[this._config.entity] as
| InputSelectEntity
| undefined;
if (!stateObj) {
return;
}
// Update selected after rendering the items or else it won't work in Firefox
if (stateObj.attributes.options) {
this.shadowRoot!.querySelector(
"paper-listbox"
)!.selected = stateObj.attributes.options.indexOf(stateObj.state);
}
}
|
cornim/frontend
|
src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts
|
TypeScript
|
MethodDeclaration
|
private _handleAction(ev: ActionHandlerEvent) {
handleAction(this, this.hass!, this._config!, ev.detail.action!);
}
|
cornim/frontend
|
src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts
|
TypeScript
|
MethodDeclaration
|
private _selectedChanged(ev): void {
const stateObj = this.hass!.states[this._config!.entity];
const option = ev.target.selectedItem.innerText.trim();
if (option === stateObj.state) {
return;
}
forwardHaptic("light");
setInputSelectOption(this.hass!, stateObj.entity_id, option);
}
|
cornim/frontend
|
src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts
|
TypeScript
|
FunctionDeclaration
|
// Utils for computing event store from the DragMeta
// ----------------------------------------------------------------------------------------------------
function computeEventForDateSpan(dateSpan: DateSpan, dragMeta: DragMeta, calendar: Calendar): EventTuple {
let defProps = { ...dragMeta.leftoverProps }
for (let transform of calendar.pluginSystem.hooks.externalDefTransforms) {
__assign(defProps, transform(dateSpan, dragMeta))
}
let def = parseEventDef(
defProps,
dragMeta.sourceId,
dateSpan.allDay,
Boolean(dragMeta.duration), // hasEnd
calendar
)
let start = dateSpan.range.start
// only rely on time info if drop zone is all-day,
// otherwise, we already know the time
if (dateSpan.allDay && dragMeta.startTime) {
start = calendar.dateEnv.add(start, dragMeta.startTime)
}
let end = dragMeta.duration ?
calendar.dateEnv.add(start, dragMeta.duration) :
calendar.getDefaultEventEnd(dateSpan.allDay, start)
let instance = createEventInstance(def.defId, { start, end })
return { def, instance }
}
|
mer30hamid/fullcalendar
|
src/interaction/interactions-external/ExternalElementDragging.ts
|
TypeScript
|
FunctionDeclaration
|
// Utils for extracting data from element
// ----------------------------------------------------------------------------------------------------
function getDragMetaFromEl(el: HTMLElement): DragMeta {
let str = getEmbeddedElData(el, 'event')
let obj = str ?
JSON.parse(str) :
{ create: false } // if no embedded data, assume no event creation
return parseDragMeta(obj)
}
|
mer30hamid/fullcalendar
|
src/interaction/interactions-external/ExternalElementDragging.ts
|
TypeScript
|
FunctionDeclaration
|
function getEmbeddedElData(el: HTMLElement, name: string): string {
let prefix = config.dataAttrPrefix
let prefixedName = (prefix ? prefix + '-' : '') + name
return el.getAttribute('data-' + prefixedName) || ''
}
|
mer30hamid/fullcalendar
|
src/interaction/interactions-external/ExternalElementDragging.ts
|
TypeScript
|
ArrowFunction
|
(ev: PointerDragEvent) => {
this.dragMeta = this.buildDragMeta(ev.subjectEl as HTMLElement)
}
|
mer30hamid/fullcalendar
|
src/interaction/interactions-external/ExternalElementDragging.ts
|
TypeScript
|
ArrowFunction
|
(hit: Hit | null, isFinal: boolean, ev: PointerDragEvent) => {
let { dragging } = this.hitDragging
let receivingCalendar: Calendar | null = null
let droppableEvent: EventTuple | null = null
let isInvalid = false
let interaction: EventInteractionState = {
affectedEvents: createEmptyEventStore(),
mutatedEvents: createEmptyEventStore(),
isEvent: this.dragMeta!.create,
origSeg: null
}
if (hit) {
receivingCalendar = hit.component.calendar
if (this.canDropElOnCalendar(ev.subjectEl as HTMLElement, receivingCalendar)) {
droppableEvent = computeEventForDateSpan(
hit.dateSpan,
this.dragMeta!,
receivingCalendar
)
interaction.mutatedEvents = eventTupleToStore(droppableEvent)
isInvalid = !isInteractionValid(interaction, receivingCalendar)
if (isInvalid) {
interaction.mutatedEvents = createEmptyEventStore()
droppableEvent = null
}
}
}
this.displayDrag(receivingCalendar, interaction)
// show mirror if no already-rendered mirror element OR if we are shutting down the mirror (?)
// TODO: wish we could somehow wait for dispatch to guarantee render
dragging.setMirrorIsVisible(
isFinal || !droppableEvent || !document.querySelector('.fc-mirror')
)
if (!isInvalid) {
enableCursor()
} else {
disableCursor()
}
if (!isFinal) {
dragging.setMirrorNeedsRevert(!droppableEvent)
this.receivingCalendar = receivingCalendar
this.droppableEvent = droppableEvent
}
}
|
mer30hamid/fullcalendar
|
src/interaction/interactions-external/ExternalElementDragging.ts
|
TypeScript
|
ArrowFunction
|
(pev: PointerDragEvent) => {
let { receivingCalendar, droppableEvent } = this
this.clearDrag()
if (receivingCalendar && droppableEvent) {
let finalHit = this.hitDragging.finalHit!
let finalView = finalHit.component.view
let dragMeta = this.dragMeta!
let arg = receivingCalendar.buildDatePointApi(finalHit.dateSpan) as ExternalDropApi
arg.draggedEl = pev.subjectEl as HTMLElement
arg.jsEvent = pev.origEvent
arg.view = finalView
receivingCalendar.publiclyTrigger('drop', [ arg ])
if (dragMeta.create) {
receivingCalendar.dispatch({
type: 'MERGE_EVENTS',
eventStore: eventTupleToStore(droppableEvent)
})
if (pev.isTouch) {
receivingCalendar.dispatch({
type: 'SELECT_EVENT',
eventInstanceId: droppableEvent.instance.instanceId
})
}
// signal that an external event landed
receivingCalendar.publiclyTrigger('eventReceive', [
{
draggedEl: pev.subjectEl,
event: new EventApi(
receivingCalendar,
droppableEvent.def,
droppableEvent.instance
),
view: finalView
}
])
}
}
this.receivingCalendar = null
this.droppableEvent = null
}
|
mer30hamid/fullcalendar
|
src/interaction/interactions-external/ExternalElementDragging.ts
|
TypeScript
|
ClassDeclaration
|
/*
Given an already instantiated draggable object for one-or-more elements,
Interprets any dragging as an attempt to drag an events that lives outside
of a calendar onto a calendar.
*/
export default class ExternalElementDragging {
hitDragging: HitDragging
receivingCalendar: Calendar | null = null
droppableEvent: EventTuple | null = null // will exist for all drags, even if create:false
suppliedDragMeta: DragMetaGenerator | null = null
dragMeta: DragMeta | null = null
constructor(dragging: ElementDragging, suppliedDragMeta?: DragMetaGenerator) {
let hitDragging = this.hitDragging = new HitDragging(dragging, interactionSettingsStore)
hitDragging.requireInitial = false // will start outside of a component
hitDragging.emitter.on('dragstart', this.handleDragStart)
hitDragging.emitter.on('hitupdate', this.handleHitUpdate)
hitDragging.emitter.on('dragend', this.handleDragEnd)
this.suppliedDragMeta = suppliedDragMeta
}
handleDragStart = (ev: PointerDragEvent) => {
this.dragMeta = this.buildDragMeta(ev.subjectEl as HTMLElement)
}
buildDragMeta(subjectEl: HTMLElement) {
if (typeof this.suppliedDragMeta === 'object') {
return parseDragMeta(this.suppliedDragMeta)
} else if (typeof this.suppliedDragMeta === 'function') {
return parseDragMeta(this.suppliedDragMeta(subjectEl))
} else {
return getDragMetaFromEl(subjectEl)
}
}
handleHitUpdate = (hit: Hit | null, isFinal: boolean, ev: PointerDragEvent) => {
let { dragging } = this.hitDragging
let receivingCalendar: Calendar | null = null
let droppableEvent: EventTuple | null = null
let isInvalid = false
let interaction: EventInteractionState = {
affectedEvents: createEmptyEventStore(),
mutatedEvents: createEmptyEventStore(),
isEvent: this.dragMeta!.create,
origSeg: null
}
if (hit) {
receivingCalendar = hit.component.calendar
if (this.canDropElOnCalendar(ev.subjectEl as HTMLElement, receivingCalendar)) {
droppableEvent = computeEventForDateSpan(
hit.dateSpan,
this.dragMeta!,
receivingCalendar
)
interaction.mutatedEvents = eventTupleToStore(droppableEvent)
isInvalid = !isInteractionValid(interaction, receivingCalendar)
if (isInvalid) {
interaction.mutatedEvents = createEmptyEventStore()
droppableEvent = null
}
}
}
this.displayDrag(receivingCalendar, interaction)
// show mirror if no already-rendered mirror element OR if we are shutting down the mirror (?)
// TODO: wish we could somehow wait for dispatch to guarantee render
dragging.setMirrorIsVisible(
isFinal || !droppableEvent || !document.querySelector('.fc-mirror')
)
if (!isInvalid) {
enableCursor()
} else {
disableCursor()
}
if (!isFinal) {
dragging.setMirrorNeedsRevert(!droppableEvent)
this.receivingCalendar = receivingCalendar
this.droppableEvent = droppableEvent
}
}
handleDragEnd = (pev: PointerDragEvent) => {
let { receivingCalendar, droppableEvent } = this
this.clearDrag()
if (receivingCalendar && droppableEvent) {
let finalHit = this.hitDragging.finalHit!
let finalView = finalHit.component.view
let dragMeta = this.dragMeta!
let arg = receivingCalendar.buildDatePointApi(finalHit.dateSpan) as ExternalDropApi
arg.draggedEl = pev.subjectEl as HTMLElement
arg.jsEvent = pev.origEvent
arg.view = finalView
receivingCalendar.publiclyTrigger('drop', [ arg ])
if (dragMeta.create) {
receivingCalendar.dispatch({
type: 'MERGE_EVENTS',
eventStore: eventTupleToStore(droppableEvent)
})
if (pev.isTouch) {
receivingCalendar.dispatch({
type: 'SELECT_EVENT',
eventInstanceId: droppableEvent.instance.instanceId
})
}
// signal that an external event landed
receivingCalendar.publiclyTrigger('eventReceive', [
{
draggedEl: pev.subjectEl,
event: new EventApi(
receivingCalendar,
droppableEvent.def,
droppableEvent.instance
),
view: finalView
}
])
}
}
this.receivingCalendar = null
this.droppableEvent = null
}
displayDrag(nextCalendar: Calendar | null, state: EventInteractionState) {
let prevCalendar = this.receivingCalendar
if (prevCalendar && prevCalendar !== nextCalendar) {
prevCalendar.dispatch({ type: 'UNSET_EVENT_DRAG' })
}
if (nextCalendar) {
nextCalendar.dispatch({ type: 'SET_EVENT_DRAG', state })
}
}
clearDrag() {
if (this.receivingCalendar) {
this.receivingCalendar.dispatch({ type: 'UNSET_EVENT_DRAG' })
}
}
canDropElOnCalendar(el: HTMLElement, receivingCalendar: Calendar): boolean {
let dropAccept = receivingCalendar.opt('dropAccept')
if (typeof dropAccept === 'function') {
return dropAccept(el)
} else if (typeof dropAccept === 'string' && dropAccept) {
return Boolean(elementMatches(el, dropAccept))
}
return true
}
}
|
mer30hamid/fullcalendar
|
src/interaction/interactions-external/ExternalElementDragging.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface ExternalDropApi extends DatePointApi {
draggedEl: HTMLElement
jsEvent: UIEvent
view: View
}
|
mer30hamid/fullcalendar
|
src/interaction/interactions-external/ExternalElementDragging.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type DragMetaGenerator = DragMetaInput | ((el: HTMLElement) => DragMetaInput)
|
mer30hamid/fullcalendar
|
src/interaction/interactions-external/ExternalElementDragging.ts
|
TypeScript
|
MethodDeclaration
|
buildDragMeta(subjectEl: HTMLElement) {
if (typeof this.suppliedDragMeta === 'object') {
return parseDragMeta(this.suppliedDragMeta)
} else if (typeof this.suppliedDragMeta === 'function') {
return parseDragMeta(this.suppliedDragMeta(subjectEl))
} else {
return getDragMetaFromEl(subjectEl)
}
}
|
mer30hamid/fullcalendar
|
src/interaction/interactions-external/ExternalElementDragging.ts
|
TypeScript
|
MethodDeclaration
|
displayDrag(nextCalendar: Calendar | null, state: EventInteractionState) {
let prevCalendar = this.receivingCalendar
if (prevCalendar && prevCalendar !== nextCalendar) {
prevCalendar.dispatch({ type: 'UNSET_EVENT_DRAG' })
}
if (nextCalendar) {
nextCalendar.dispatch({ type: 'SET_EVENT_DRAG', state })
}
}
|
mer30hamid/fullcalendar
|
src/interaction/interactions-external/ExternalElementDragging.ts
|
TypeScript
|
MethodDeclaration
|
clearDrag() {
if (this.receivingCalendar) {
this.receivingCalendar.dispatch({ type: 'UNSET_EVENT_DRAG' })
}
}
|
mer30hamid/fullcalendar
|
src/interaction/interactions-external/ExternalElementDragging.ts
|
TypeScript
|
MethodDeclaration
|
canDropElOnCalendar(el: HTMLElement, receivingCalendar: Calendar): boolean {
let dropAccept = receivingCalendar.opt('dropAccept')
if (typeof dropAccept === 'function') {
return dropAccept(el)
} else if (typeof dropAccept === 'string' && dropAccept) {
return Boolean(elementMatches(el, dropAccept))
}
return true
}
|
mer30hamid/fullcalendar
|
src/interaction/interactions-external/ExternalElementDragging.ts
|
TypeScript
|
FunctionDeclaration
|
export function extractAuthor (digest: Digest, sessionValidators: AccountId[] = []): AccountId | undefined {
const [pitem] = digest.logs.filter(({ type }) => type === 'PreRuntime');
// extract from the substrate 2.0 PreRuntime digest
if (pitem) {
const [engine, data] = pitem.asPreRuntime;
return engine.extractAuthor(data, sessionValidators);
} else {
const [citem] = digest.logs.filter(({ type }) => type === 'Consensus');
// extract author from the consensus (substrate 1.0, digest)
if (citem) {
const [engine, data] = citem.asConsensus;
return engine.extractAuthor(data, sessionValidators);
}
}
return undefined;
}
|
icodezjb/api
|
packages/api-derive/src/type/util.ts
|
TypeScript
|
ArrowFunction
|
({ type }) => type === 'PreRuntime'
|
icodezjb/api
|
packages/api-derive/src/type/util.ts
|
TypeScript
|
ArrowFunction
|
({ type }) => type === 'Consensus'
|
icodezjb/api
|
packages/api-derive/src/type/util.ts
|
TypeScript
|
ArrowFunction
|
() => [Order]
|
AhmadSinaSaeedi/nestjs-online-shop
|
src/orders/orders.resolver.ts
|
TypeScript
|
ArrowFunction
|
(i) => mapOrderEntityToDto(i)
|
AhmadSinaSaeedi/nestjs-online-shop
|
src/orders/orders.resolver.ts
|
TypeScript
|
ArrowFunction
|
() => Order
|
AhmadSinaSaeedi/nestjs-online-shop
|
src/orders/orders.resolver.ts
|
TypeScript
|
ClassDeclaration
|
@Resolver('Orders')
export class OrdersResolver {
constructor(private OrdersService: OrdersService) {}
@Query(() => [Order])
async orders(): Promise<Order[]> {
const orders = await this.OrdersService.findAll();
return orders.map((i) => mapOrderEntityToDto(i));
}
@Query(() => Order)
async order(@Args('id') id: string) {
const order = await this.OrdersService.findById(id);
return mapOrderEntityToDto(order);
}
@Mutation(() => Order)
async orderCreate(@Args('data') data: OrderInput) {
console.log('data', data.items);
return null;
}
}
|
AhmadSinaSaeedi/nestjs-online-shop
|
src/orders/orders.resolver.ts
|
TypeScript
|
MethodDeclaration
|
@Query(() => [Order])
async orders(): Promise<Order[]> {
const orders = await this.OrdersService.findAll();
return orders.map((i) => mapOrderEntityToDto(i));
}
|
AhmadSinaSaeedi/nestjs-online-shop
|
src/orders/orders.resolver.ts
|
TypeScript
|
MethodDeclaration
|
@Query(() => Order)
async order(@Args('id') id: string) {
const order = await this.OrdersService.findById(id);
return mapOrderEntityToDto(order);
}
|
AhmadSinaSaeedi/nestjs-online-shop
|
src/orders/orders.resolver.ts
|
TypeScript
|
MethodDeclaration
|
@Mutation(() => Order)
async orderCreate(@Args('data') data: OrderInput) {
console.log('data', data.items);
return null;
}
|
AhmadSinaSaeedi/nestjs-online-shop
|
src/orders/orders.resolver.ts
|
TypeScript
|
ClassDeclaration
|
declare class NodeHandler {
handler: Handler;
constructor(handler: Handler);
/**
* Get the node path by target object
* @param {NodeObject} target
* @param {NodeObject[]} [nodes=[]]
* @param {string} [direction='init']
*/
getNodePath: (target: NodeObject, nodes?: NodeObject[], direction?: string) => void;
/**
* Select the node path
* @param {string[]} [path]
*/
selectByPath: (path?: string[]) => void;
/**
* Select node by id
* @param {string} id
*/
selectById: (id: string) => void;
/**
* Deselect nodes
*/
deselect: () => void;
/**
* Highlight node path
* @param {string[]} [path]
*/
highlightingByPath: (path?: string[]) => void;
/**
* Highlight link
* @param {FabricObject} object
* @param {FabricObject} targetObject
* @param {number} [duration=500]
*/
highlightingLink: (object: FabricObject, targetObject: FabricObject, duration?: number) => void;
/**
* Highlight node
*
* @param {*} object
* @param {number} [duration=500]
* @param {number} [minBlur=0]
* @param {number} [maxBlur=50]
*/
highlightingNode: (object: any, duration?: number, minBlur?: number, maxBlur?: number) => void;
}
|
LeHaine/react-design-editor
|
lib/handlers/NodeHandler.d.ts
|
TypeScript
|
ClassDeclaration
|
@Component({
selector: 'app-ideogram',
templateUrl: './ideogram.component.html',
styleUrls: ['./ideogram.component.css']
})
export class IdeogramComponent implements OnInit {
constructor() { }
ngOnInit() {
this.createIdeogram();
}
createIdeogram() {
const ideogram = new Ideogram({
organism: 'human',
dataDir: 'https://unpkg.com/ideogram@0.10.0/dist/data/bands/native/',
container: '#ideo-container'
});
}
}
|
Zhu-Ying/ideogram
|
examples/angular/src/app/ideogram/ideogram.component.ts
|
TypeScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.