type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
|---|---|---|---|---|
ArrowFunction
|
async () => {
const { result } = renderHook(() => useClassName({ bg: 'primary' }));
const { getByTestId } = render(
<button className={result.current} data-testid="button" />,
);
const button = getByTestId('button');
expect(button).toHaveStyle(
`background-color: ${morfeo.getTheme()['colors']['primary']}`,
);
}
|
LucaCorcella/morfeo
|
packages/react/tests/useClassName.test.tsx
|
TypeScript
|
ArrowFunction
|
() => useClassName({ bg: 'primary' })
|
LucaCorcella/morfeo
|
packages/react/tests/useClassName.test.tsx
|
TypeScript
|
ArrowFunction
|
(): number => {
const now = new Date();
return Math.floor(Date.UTC(
now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(),
now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds()
) / 1000);
}
|
localization-one/lo-api
|
src/base/date-functions.ts
|
TypeScript
|
InterfaceDeclaration
|
/**
* DescribeBrokerInput shape
*/
export interface DescribeBrokerInput {
/**
* The name of the broker. This value must be unique in your AWS account, 1-50 characters long, must contain only letters, numbers, dashes, and underscores, and must not contain whitespaces, brackets, wildcard characters, or special characters.
*/
BrokerId: string;
/**
* The maximum number of times this operation should be retried. If set, this value will override the `maxRetries` configuration set on the client for this command.
*/
$maxRetries?: number;
/**
* An object that may be queried to determine if the underlying operation has been aborted.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
*/
$abortSignal?: __aws_sdk_types.AbortSignal;
/**
* Per-request HTTP configuration options. If set, any options specified will override the corresponding HTTP option set on the client for this command.
*/
$httpOptions?: __HttpOptions__;
}
|
Dylan0916/aws-sdk-js-v3
|
clients/node/client-mq-node/types/DescribeBrokerInput.ts
|
TypeScript
|
ArrowFunction
|
() => {
const server = express()
server.use(cookieParser())
server.get('/', (req, res) => {
app.render(req, res, '/images')
})
server.get('/dev', (req, res) => {
if (!dev) {
res.status(403)
}
app.render(req, res, '/dev')
})
server.get('/u/:id', (req, res) => {
app.render(req, res, '/user-show')
})
server.get('/p', (req, res) => {
app.render(req, res, '/posts')
})
server.get('/p/:id', (req, res) => {
app.render(req, res, '/post-show')
})
server.get('/article', (req, res) => {
app.render(req, res, '/articles')
})
server.get('/article/:id', (req, res) => {
app.render(req, res, '/article-show')
})
server.get('/r', (req, res) => {
app.render(req, res, '/reviews')
})
server.get('/a/:id', (req, res) => {
if (req.params.id === '112') {
// 兼容v1 about
res.redirect(301, '/p/1')
return
}
app.render(req, res, '/album-show')
})
server.get('/a', (req, res) => {
app.render(req, res, '/albums')
})
server.get('/retrieve-password', (req, res) => {
app.render(req, res, '/retrieve-password')
})
server.get('download', (req, res) => {
app.render(req, res, '/download')
})
server.get('/d', (req, res) => {
app.render(req, res, '/download')
})
server.get('/error/:code', (req, res) => {
app.render(req, res, '/exception')
})
server.get('*', (req, res) => {
const rootStaticFiles = [
'/robots.txt',
// '/sitemap.xml',
// '/favicon.ico',
'/jd_root.txt',
]
if (rootStaticFiles.indexOf(req.url) > -1) {
const path = join(__dirname, '..', 'static', req.url)
res.sendFile(path)
} else {
return handle(req, res)
}
})
server.listen(3000, (err) => {
if (err) {
throw err
}
console.log('> Ready on http://localhost:3000')
})
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(req, res) => {
app.render(req, res, '/images')
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(req, res) => {
if (!dev) {
res.status(403)
}
app.render(req, res, '/dev')
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(req, res) => {
app.render(req, res, '/user-show')
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(req, res) => {
app.render(req, res, '/posts')
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(req, res) => {
app.render(req, res, '/post-show')
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(req, res) => {
app.render(req, res, '/articles')
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(req, res) => {
app.render(req, res, '/article-show')
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(req, res) => {
app.render(req, res, '/reviews')
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(req, res) => {
if (req.params.id === '112') {
// 兼容v1 about
res.redirect(301, '/p/1')
return
}
app.render(req, res, '/album-show')
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(req, res) => {
app.render(req, res, '/albums')
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(req, res) => {
app.render(req, res, '/retrieve-password')
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(req, res) => {
app.render(req, res, '/download')
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(req, res) => {
app.render(req, res, '/exception')
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(req, res) => {
const rootStaticFiles = [
'/robots.txt',
// '/sitemap.xml',
// '/favicon.ico',
'/jd_root.txt',
]
if (rootStaticFiles.indexOf(req.url) > -1) {
const path = join(__dirname, '..', 'static', req.url)
res.sendFile(path)
} else {
return handle(req, res)
}
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(err) => {
if (err) {
throw err
}
console.log('> Ready on http://localhost:3000')
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ArrowFunction
|
(ex) => {
console.error(ex.stack)
process.exit(1)
}
|
imgtrip/surface
|
src/server.ts
|
TypeScript
|
ClassDeclaration
|
export class TimestampEntity {
@CreateDateColumn({
update: false //On ne peut plus modifier ce champ
})
createdAt: Date;
@UpdateDateColumn()
updatedAt: Date;
@DeleteDateColumn()
deletedAt: Date;
}
|
SindaJeddey/Todo-List
|
src/generics/timestamp.entity.ts
|
TypeScript
|
ArrowFunction
|
async () => {}
|
hanxie-crypto/velaux
|
src/extends/Ignore/index.tsx
|
TypeScript
|
ClassDeclaration
|
class Ignore extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
dataSource: [],
};
}
componentDidMount = async () => {};
render() {
return <div></div>;
}
}
|
hanxie-crypto/velaux
|
src/extends/Ignore/index.tsx
|
TypeScript
|
TypeAliasDeclaration
|
type DataSource = Array<{ label: string; value: any }>;
|
hanxie-crypto/velaux
|
src/extends/Ignore/index.tsx
|
TypeScript
|
TypeAliasDeclaration
|
type Props = {
url: string;
};
|
hanxie-crypto/velaux
|
src/extends/Ignore/index.tsx
|
TypeScript
|
TypeAliasDeclaration
|
type State = {};
|
hanxie-crypto/velaux
|
src/extends/Ignore/index.tsx
|
TypeScript
|
MethodDeclaration
|
render() {
return <div></div>;
}
|
hanxie-crypto/velaux
|
src/extends/Ignore/index.tsx
|
TypeScript
|
ArrowFunction
|
() => "CURRENT_TIMESTAMP"
|
luoyuhou/service
|
src/users-logs/users-logs.entity.ts
|
TypeScript
|
ClassDeclaration
|
@Entity("users_logs", { schema: "apps" })
export class UsersLogs {
@PrimaryGeneratedColumn({ type: "int", name: "users_logs_id" })
usersLogsId: number;
@Column("varchar", { name: "users_logs_users_u_id", length: 64 })
usersLogsUsersUId: string;
@Column("varchar", { name: "users_logs_ip", length: 32 })
usersLogsIp: string;
@Column("varchar", { name: "users_logs_agent", nullable: true, length: 255 })
usersLogsAgent: string | null;
@Column("varchar", { name: "users_logs_operation", length: 255 })
usersLogsOperation: string;
@Column("datetime", {
name: "users_logs_create_date",
default: () => "CURRENT_TIMESTAMP",
})
usersLogsCreateDate: Date;
}
|
luoyuhou/service
|
src/users-logs/users-logs.entity.ts
|
TypeScript
|
ArrowFunction
|
() => import("../../widgets/PianoWidget")
|
hartley9/jacdac-docs
|
src/components/blockly/fields/NoteField.tsx
|
TypeScript
|
ArrowFunction
|
async (newFrequency: number) => {
this.value = newFrequency
if (!this.toneContext) this.toneContext = createToneContext()
this.toneContext?.playTone(newFrequency, 400, 0.5)
}
|
hartley9/jacdac-docs
|
src/components/blockly/fields/NoteField.tsx
|
TypeScript
|
ClassDeclaration
|
export default class NoteField extends ReactField<number> {
static KEY = "jacdac_field_note"
static SHADOW = toShadowDefinition(NoteField)
toneContext: ToneContext
static fromJson(options: ReactFieldJSON) {
return new NoteField(options)
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(options?: any) {
super(options?.value, undefined, options)
}
get defaultValue() {
return 440
}
getText_() {
return (this.value | 0) + ""
}
renderField(): ReactNode {
const handlePlayTone = async (newFrequency: number) => {
this.value = newFrequency
if (!this.toneContext) this.toneContext = createToneContext()
this.toneContext?.playTone(newFrequency, 400, 0.5)
}
return (
<Suspense>
<PianoWidget playTone={handlePlayTone} />
</Suspense>
)
}
}
|
hartley9/jacdac-docs
|
src/components/blockly/fields/NoteField.tsx
|
TypeScript
|
MethodDeclaration
|
static fromJson(options: ReactFieldJSON) {
return new NoteField(options)
}
|
hartley9/jacdac-docs
|
src/components/blockly/fields/NoteField.tsx
|
TypeScript
|
MethodDeclaration
|
getText_() {
return (this.value | 0) + ""
}
|
hartley9/jacdac-docs
|
src/components/blockly/fields/NoteField.tsx
|
TypeScript
|
MethodDeclaration
|
renderField(): ReactNode {
const handlePlayTone = async (newFrequency: number) => {
this.value = newFrequency
if (!this.toneContext) this.toneContext = createToneContext()
this.toneContext?.playTone(newFrequency, 400, 0.5)
}
return (
<Suspense>
<PianoWidget playTone={handlePlayTone} />
</Suspense>
)
}
|
hartley9/jacdac-docs
|
src/components/blockly/fields/NoteField.tsx
|
TypeScript
|
ClassDeclaration
|
@Component({
selector: 'card-platforms',
templateUrl: './platforms.component.html',
styleUrls: ['./platforms.component.less'],
})
export class CardPlatformsComponent implements OnInit {
// Used to track which component is being loaded
componentName = 'CardPlatformsComponent';
constructor() {}
@Input()
platforms: Platform[];
config: CardConfig;
ngOnInit() {
this.config = {
titleBorder: true,
topBorder: true,
} as CardConfig;
}
}
|
ChrisRo89/galaxy
|
galaxyui/src/app/content-detail/cards/platforms/platforms.component.ts
|
TypeScript
|
MethodDeclaration
|
ngOnInit() {
this.config = {
titleBorder: true,
topBorder: true,
} as CardConfig;
}
|
ChrisRo89/galaxy
|
galaxyui/src/app/content-detail/cards/platforms/platforms.component.ts
|
TypeScript
|
FunctionDeclaration
|
export default function createPageConfig(Page: React.ComponentType<any>, name: string) {
const page = {
lifeCycleCallback: {} as LifeCycleCallback,
wrapperRef: React.createRef<any>(),
registerLifecycle(lifeCycle: Lifecycle, callback: () => any) {
this.lifeCycleCallback[lifeCycle] = this.lifeCycleCallback[lifeCycle] || [];
this.lifeCycleCallback[lifeCycle].push(callback);
return () => {
this.lifeCycleCallback[lifeCycle].splice(this.lifeCycleCallback[lifeCycle].indexOf(callback), 1);
};
},
callLifecycle(lifeCycle: Lifecycle, ...args: any[]) {
const callbacks = this.lifeCycleCallback[lifeCycle] || [];
let result;
callbacks.forEach((callback: any) => {
result = callback(...args);
});
if (result) {
return result;
}
const callback = callbackName(lifeCycle);
if (this.wrapperRef.current && this.wrapperRef.current[callback]) {
return this.wrapperRef.current[callback](...args);
}
},
};
const PageWrapper = createPageWrapper(Page, name);
return class PageConfig extends React.Component<PageConfigProps> {
constructor(props: any) {
super(props);
props.cacheLifecycles.didCache(this.componentDidCache);
props.cacheLifecycles.didRecover(this.componentDidRecover);
}
state = {
refreshing: true,
};
title = this.props.pageConfig.defaultTitle || document.title;
componentDidMount() {
this.setTitle();
page.callLifecycle(Lifecycle.load);
page.callLifecycle(Lifecycle.show);
page.callLifecycle(Lifecycle.ready);
this.registerPageScroll();
}
componentWillUnmount() {
this.unregisterPageScroll();
}
componentDidCache = () => {
this.title = document.title;
page.callLifecycle(Lifecycle.hide);
this.unregisterPageScroll();
};
componentDidRecover = () => {
this.setTitle();
page.callLifecycle(Lifecycle.show);
};
setTitle = () => {
document.title = this.title;
};
isPullDownRefreshEnabled = () => {
const { pageConfig } = this.props;
return pageConfig.pullRefresh;
};
getReachBottomDistance = () => {
const { pageConfig } = this.props;
return pageConfig.onReachBottomDistance ?? DEFAULT_REACH_BOTTOM_DISTANCE;
};
isReachBottom = false;
scrollEvent = () => {
this.checkReachBottom();
const event = { scrollTop: window.scrollY };
page.callLifecycle(Lifecycle.pageScroll, event);
};
registerPageScroll = () => {
window.addEventListener('scroll', this.scrollEvent);
};
unregisterPageScroll = () => {
window.removeEventListener('scroll', this.scrollEvent);
};
handleRefresh = async () => {
this.setState({
refreshing: true,
});
try {
await page.callLifecycle(Lifecycle.pullDownRefresh);
} catch (error) {
this.setState({
refreshing: false,
});
throw error;
}
this.setState({
refreshing: false,
});
};
checkReachBottom = () => {
const isCurrentReachBottom =
document.body.scrollHeight - (window.innerHeight + window.scrollY) <= this.getReachBottomDistance();
if (!this.isReachBottom && isCurrentReachBottom) {
this.isReachBottom = true;
page.callLifecycle(Lifecycle.reachBottom);
return;
}
this.isReachBottom = isCurrentReachBottom;
};
render() {
const { tabBar, location } = this.props;
const { refreshing } = this.state;
const hasTabBar = !!tabBar;
const className = `remax-page ${hasTabBar ? 'with-tab-bar' : ''}`;
const query = qs.parse(location.search, { ignoreQueryPrefix: true });
if (this.isPullDownRefreshEnabled()) {
return (
<PullToRefresh onRefresh={this.handleRefresh} refreshing={refreshing} distanceToRefresh={50}>
<div className={className}>
{React.createElement(PageWrapper, {
page,
query,
ref: page.wrapperRef,
})}
</div>
</PullToRefresh>
);
}
return (
<div className={className}>
{React.createElement(PageWrapper, {
page,
query,
ref: page.wrapperRef,
})}
</div>
);
}
};
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
ArrowFunction
|
() => {
this.lifeCycleCallback[lifeCycle].splice(this.lifeCycleCallback[lifeCycle].indexOf(callback), 1);
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
ArrowFunction
|
(callback: any) => {
result = callback(...args);
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
ArrowFunction
|
() => {
this.title = document.title;
page.callLifecycle(Lifecycle.hide);
this.unregisterPageScroll();
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
ArrowFunction
|
() => {
this.setTitle();
page.callLifecycle(Lifecycle.show);
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
ArrowFunction
|
() => {
document.title = this.title;
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const { pageConfig } = this.props;
return pageConfig.pullRefresh;
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const { pageConfig } = this.props;
return pageConfig.onReachBottomDistance ?? DEFAULT_REACH_BOTTOM_DISTANCE;
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
ArrowFunction
|
() => {
this.checkReachBottom();
const event = { scrollTop: window.scrollY };
page.callLifecycle(Lifecycle.pageScroll, event);
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
ArrowFunction
|
() => {
window.addEventListener('scroll', this.scrollEvent);
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
ArrowFunction
|
() => {
window.removeEventListener('scroll', this.scrollEvent);
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
ArrowFunction
|
async () => {
this.setState({
refreshing: true,
});
try {
await page.callLifecycle(Lifecycle.pullDownRefresh);
} catch (error) {
this.setState({
refreshing: false,
});
throw error;
}
this.setState({
refreshing: false,
});
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const isCurrentReachBottom =
document.body.scrollHeight - (window.innerHeight + window.scrollY) <= this.getReachBottomDistance();
if (!this.isReachBottom && isCurrentReachBottom) {
this.isReachBottom = true;
page.callLifecycle(Lifecycle.reachBottom);
return;
}
this.isReachBottom = isCurrentReachBottom;
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
InterfaceDeclaration
|
interface LifeCycleCallback {
[key: string]: Array<() => void>;
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
InterfaceDeclaration
|
interface PageConfigProps {
tabBar: TabBarConfig;
pageConfig: PageConfig;
location: any;
cacheLifecycles?: any;
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
MethodDeclaration
|
registerLifecycle(lifeCycle: Lifecycle, callback: () => any) {
this.lifeCycleCallback[lifeCycle] = this.lifeCycleCallback[lifeCycle] || [];
this.lifeCycleCallback[lifeCycle].push(callback);
return () => {
this.lifeCycleCallback[lifeCycle].splice(this.lifeCycleCallback[lifeCycle].indexOf(callback), 1);
};
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
MethodDeclaration
|
callLifecycle(lifeCycle: Lifecycle, ...args: any[]) {
const callbacks = this.lifeCycleCallback[lifeCycle] || [];
let result;
callbacks.forEach((callback: any) => {
result = callback(...args);
});
if (result) {
return result;
}
const callback = callbackName(lifeCycle);
if (this.wrapperRef.current && this.wrapperRef.current[callback]) {
return this.wrapperRef.current[callback](...args);
}
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
MethodDeclaration
|
componentDidMount() {
this.setTitle();
page.callLifecycle(Lifecycle.load);
page.callLifecycle(Lifecycle.show);
page.callLifecycle(Lifecycle.ready);
this.registerPageScroll();
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
MethodDeclaration
|
componentWillUnmount() {
this.unregisterPageScroll();
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
MethodDeclaration
|
render() {
const { tabBar, location } = this.props;
const { refreshing } = this.state;
const hasTabBar = !!tabBar;
const className = `remax-page ${hasTabBar ? 'with-tab-bar' : ''}`;
const query = qs.parse(location.search, { ignoreQueryPrefix: true });
if (this.isPullDownRefreshEnabled()) {
return (
<PullToRefresh onRefresh={this.handleRefresh} refreshing={refreshing} distanceToRefresh={50}>
<div className={className}>
{React.createElement(PageWrapper, {
page,
query,
ref: page.wrapperRef,
})}
</div>
</PullToRefresh>
);
}
return (
<div className={className}>
{React.createElement(PageWrapper, {
page,
query,
ref: page.wrapperRef,
})}
</div>
);
}
|
1198994985/remax
|
packages/remax-web/src/createPageConfig.tsx
|
TypeScript
|
FunctionDeclaration
|
async function start() {
const serviceA = await Chalupa
.builder()
.createServiceWithStrategy(ServiceA, InMemoryStrategy)
const serviceB = await Chalupa
.builder()
.createServiceWithStrategy(ServiceB, InMemoryStrategy)
const serviceC = await Chalupa
.builder()
.createServiceWithStrategy(ServiceC, InMemoryStrategy)
setTimeout(() => serviceB.close(), 3000)
await Promise.allSettled([serviceA.start(), serviceB.start(), serviceC.start()])
}
|
chalupajs/chalupa
|
packages/examples/src/24-appeared-events/index.ts
|
TypeScript
|
ArrowFunction
|
() => serviceB.close()
|
chalupajs/chalupa
|
packages/examples/src/24-appeared-events/index.ts
|
TypeScript
|
ClassDeclaration
|
@Service()
class ServiceA {
private readonly logger: ILogger
constructor(loggerFactory: LoggerFactory) {
this.logger = loggerFactory.getLogger(ServiceA)
}
@ServiceAppeared()
onServiceAppeared(name: string) {
this.logger.info('Service appeared', name)
}
@ServiceDisappeared()
onServiceDisappeared(name: string) {
this.logger.info('Service disappeared', name)
}
}
|
chalupajs/chalupa
|
packages/examples/src/24-appeared-events/index.ts
|
TypeScript
|
ClassDeclaration
|
@Service()
class ServiceB {
private readonly logger: ILogger
constructor(loggerFactory: LoggerFactory) {
this.logger = loggerFactory.getLogger(ServiceB)
}
@ServiceAppeared()
onServiceAppeared(name: string) {
this.logger.info('Service appeared', name)
}
@ServiceDisappeared()
onServiceDisappeared(name: string) {
this.logger.info('Service disappeared', name)
}
}
|
chalupajs/chalupa
|
packages/examples/src/24-appeared-events/index.ts
|
TypeScript
|
ClassDeclaration
|
@Service()
class ServiceC {
private readonly logger: ILogger
constructor(loggerFactory: LoggerFactory) {
this.logger = loggerFactory.getLogger(ServiceC)
}
@ServiceAppeared()
onServiceAppeared(name: string) {
this.logger.info('Service appeared', name)
}
@ServiceDisappeared()
onServiceDisappeared(name: string) {
this.logger.info('Service disappeared', name)
}
}
|
chalupajs/chalupa
|
packages/examples/src/24-appeared-events/index.ts
|
TypeScript
|
MethodDeclaration
|
@ServiceAppeared()
onServiceAppeared(name: string) {
this.logger.info('Service appeared', name)
}
|
chalupajs/chalupa
|
packages/examples/src/24-appeared-events/index.ts
|
TypeScript
|
MethodDeclaration
|
@ServiceDisappeared()
onServiceDisappeared(name: string) {
this.logger.info('Service disappeared', name)
}
|
chalupajs/chalupa
|
packages/examples/src/24-appeared-events/index.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface RPCOptions {
block: string;
}
|
Smartlinkhub/Smartlink-Farms
|
deploy/node_modules/@taquito/rpc/dist/types/rpc-client-interface.d.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface RpcClientInterface {
getBlockHash(options?: RPCOptions): Promise<string>;
getLiveBlocks(options?: RPCOptions): Promise<string[]>;
getBalance(address: string, options?: RPCOptions): Promise<BalanceResponse>;
getStorage(address: string, options?: RPCOptions): Promise<StorageResponse>;
getScript(address: string, options?: RPCOptions): Promise<ScriptResponse>;
getContract(address: string, options?: RPCOptions): Promise<ContractResponse>;
getManagerKey(address: string, options?: RPCOptions): Promise<ManagerKeyResponse>;
getDelegate(address: string, options?: RPCOptions): Promise<DelegateResponse>;
getBigMapKey(address: string, key: BigMapKey, options?: RPCOptions): Promise<BigMapGetResponse>;
getBigMapExpr(id: string, expr: string, options?: RPCOptions): Promise<BigMapResponse>;
getDelegates(address: string, options?: RPCOptions): Promise<DelegatesResponse>;
getConstants(options?: RPCOptions): Promise<ConstantsResponse>;
getBlock(options?: RPCOptions): Promise<BlockResponse>;
getBlockHeader(options?: RPCOptions): Promise<BlockHeaderResponse>;
getBlockMetadata(options?: RPCOptions): Promise<BlockMetadata>;
getBakingRights(args: BakingRightsQueryArguments, options?: RPCOptions): Promise<BakingRightsResponse>;
getEndorsingRights(args: EndorsingRightsQueryArguments, options?: RPCOptions): Promise<EndorsingRightsResponse>;
getBallotList(options?: RPCOptions): Promise<BallotListResponse>;
getBallots(options?: RPCOptions): Promise<BallotsResponse>;
getCurrentPeriodKind(options?: RPCOptions): Promise<PeriodKindResponse>;
getCurrentProposal(options?: RPCOptions): Promise<CurrentProposalResponse>;
getCurrentQuorum(options?: RPCOptions): Promise<CurrentQuorumResponse>;
getVotesListings(options?: RPCOptions): Promise<VotesListingsResponse>;
getProposals(options?: RPCOptions): Promise<ProposalsResponse>;
forgeOperations(data: ForgeOperationsParams, options?: RPCOptions): Promise<string>;
injectOperation(signedOpBytes: string): Promise<OperationHash>;
preapplyOperations(ops: PreapplyParams, options?: RPCOptions): Promise<PreapplyResponse[]>;
getEntrypoints(contract: string, options?: RPCOptions): Promise<EntrypointsResponse>;
runOperation(op: RPCRunOperationParam, options?: RPCOptions): Promise<PreapplyResponse>;
runCode(code: RPCRunCodeParam, options?: RPCOptions): Promise<RunCodeResult>;
getChainId(): Promise<string>;
packData(data: PackDataParams, options?: RPCOptions): Promise<{
packed: string;
gas: BigNumber | 'unaccounted' | undefined;
}>;
getRpcUrl(): string;
getCurrentPeriod(options?: RPCOptions): Promise<VotingPeriodBlockResult>;
getSuccessorPeriod(options?: RPCOptions): Promise<VotingPeriodBlockResult>;
getSaplingDiffById(id: string, options?: RPCOptions): Promise<SaplingDiffResponse>;
getSaplingDiffByContract(contract: string, options?: RPCOptions): Promise<SaplingDiffResponse>;
}
|
Smartlinkhub/Smartlink-Farms
|
deploy/node_modules/@taquito/rpc/dist/types/rpc-client-interface.d.ts
|
TypeScript
|
ArrowFunction
|
(theme: Theme) => {
return createStyles({
root: {
display: 'flex',
},
main: {
flexGrow: 1,
padding: theme.spacing(3),
},
toolbar: theme.mixins.toolbar,
});
}
|
MeowwBox/lunasec
|
js/demo-apps/packages/react-front-end/src/index.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const classes = useStyles({});
const location = useLocation();
const mode = location.pathname.split('/')[1] as Mode; //todo: make this work with react router instead..
const transport = getTransport(mode);
const loadUser = useStoreActions((actions) => actions.loadUser);
useEffect(() => {
loadUser({ transport });
}, [loadUser, transport]);
return (
<>
<Route exact path="/">
<Redirect to="/express" />
</Route>
<Route
path="/:mode"
render={()
|
MeowwBox/lunasec
|
js/demo-apps/packages/react-front-end/src/index.tsx
|
TypeScript
|
ArrowFunction
|
(actions) => actions.loadUser
|
MeowwBox/lunasec
|
js/demo-apps/packages/react-front-end/src/index.tsx
|
TypeScript
|
ArrowFunction
|
() => {
loadUser({ transport });
}
|
MeowwBox/lunasec
|
js/demo-apps/packages/react-front-end/src/index.tsx
|
TypeScript
|
InterfaceDeclaration
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface DefaultTheme extends Theme {}
|
MeowwBox/lunasec
|
js/demo-apps/packages/react-front-end/src/index.tsx
|
TypeScript
|
InterfaceDeclaration
|
export interface InstalledStack extends Stack {
eventType: string
name: string
resources: any[]
sources: string[]
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface TemplateSummary extends Omit<GenTemplateSummary, 'labels'> {
labels: string[]
status: RemoteDataState
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface TemplatesState extends NormalizedState<TemplateSummary> {
exportTemplate: {status: RemoteDataState; item: DocumentCreate}
communityTemplateToInstall: CommunityTemplate
stacks: InstalledStack[]
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
interface KeyValuePairs {
[key: string]: any
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
interface DocumentMetaWithTemplateID extends DocumentMeta {
templateID?: string
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
// Templates
export interface GenTemplateBase extends Document {
meta: DocumentMetaWithTemplateID
content: {data: TemplateData; included: TemplateIncluded[]}
labels: Label[]
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface TemplateBase extends Omit<Document, 'labels'> {
meta: DocumentMetaWithTemplateID
content: {data: TemplateData; included: TemplateIncluded[]}
labels: string[]
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
// TODO: be more specific about what attributes can be
interface TemplateData {
type: TemplateType
attributes: KeyValuePairs
relationships: Relationships
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
interface TemplateIncluded {
type: TemplateType
id: string
attributes: KeyValuePairs
relationships?: Relationships
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
interface RelationshipMap {
[TemplateType.Cell]: CellRelationship
[TemplateType.Label]: LabelRelationship
[TemplateType.View]: ViewRelationship
[TemplateType.Variable]: VariableRelationship
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface CellRelationship {
type: TemplateType.Cell
id: string
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface LabelRelationship {
type: TemplateType.Label
id: string
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface VariableRelationship {
type: TemplateType.Variable
id: string
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
interface ViewRelationship {
type: TemplateType.View
id: string
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
// Template Includeds
export interface ViewIncluded extends TemplateIncluded {
type: TemplateType.View
attributes: View
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface CellIncluded extends TemplateIncluded {
type: TemplateType.Cell
attributes: Cell
relationships: {
[TemplateType.View]: {data: ViewRelationship}
}
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface LabelIncluded extends TemplateIncluded {
type: TemplateType.Label
attributes: GenLabel
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface VariableIncluded extends TemplateIncluded {
type: TemplateType.Variable
attributes: Variable
relationships: {
[TemplateType.Label]: {data: LabelRelationship[]}
}
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
// Template Data
interface TaskTemplateData extends TemplateData {
type: TemplateType.Task
attributes: {name: string; flux: string}
relationships: {
[TemplateType.Label]: {data: LabelRelationship[]}
}
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
interface DashboardTemplateData extends TemplateData {
type: TemplateType.Dashboard
attributes: Dashboard
relationships: {
[TemplateType.Label]: {data: LabelRelationship[]}
[TemplateType.Cell]: {data: CellRelationship[]}
[TemplateType.Variable]: {data: VariableRelationship[]}
}
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
interface VariableTemplateData extends TemplateData {
type: TemplateType.Variable
attributes: PostVariable
relationships: {
[TemplateType.Label]: {data: LabelRelationship[]}
[TemplateType.Variable]: {data: VariableRelationship[]}
}
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
// Templates
export interface TaskTemplate extends TemplateBase {
content: {
data: TaskTemplateData
included: TaskTemplateIncluded[]
}
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface DashboardTemplate extends TemplateBase {
content: {
data: DashboardTemplateData
included: DashboardTemplateIncluded[]
}
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface VariableTemplate extends TemplateBase {
content: {
data: VariableTemplateData
included: VariableTemplateIncluded[]
}
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type CommunityTemplate = any
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
TypeAliasDeclaration
|
// enforces key association with relationship type
export type Relationships = {
[key in keyof RelationshipMap]?: {
data: OneOrMany<RelationshipMap[key]>
}
}
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
TypeAliasDeclaration
|
type OneOrMany<T> = T | T[]
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type TaskTemplateIncluded = LabelIncluded
|
EmOne/influxdb
|
ui/src/types/templates.ts
|
TypeScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.