type stringclasses 7
values | content stringlengths 4 9.55k | repo stringlengths 7 96 | path stringlengths 4 178 | language stringclasses 1
value |
|---|---|---|---|---|
ArrowFunction |
(a:tsModel.Annotation,f:def.Property)=>{
} | petrochenko-pavel-a/raml-definition-system-vocabs | src/annotationHandlers.ts | TypeScript |
InterfaceDeclaration |
export interface AnnotationHandler{
(a:tsModel.Annotation,f:def.Property)
} | petrochenko-pavel-a/raml-definition-system-vocabs | src/annotationHandlers.ts | TypeScript |
ArrowFunction |
(t: ICronTrigger) => t.type === 'cron' && t.enabled && t.cronExpression | CODY-RAY/deck | app/scripts/modules/core/src/pipeline/triggers/NextRunTag.tsx | TypeScript |
ArrowFunction |
cron => {
const timezoneOffsetInMs = DateTime.local().setZone(SETTINGS.defaultTimeZone).offset * 60 * 1000;
const nextRun = later
.schedule(later.parse.cron(cron.cronExpression, true))
.next(1, new Date(Date.now() + timezoneOffsetInMs));
if (nextRun) {
nextTimes.p... | CODY-RAY/deck | app/scripts/modules/core/src/pipeline/triggers/NextRunTag.tsx | TypeScript |
ArrowFunction |
() => {
this.setState(this.updateSchedule());
} | CODY-RAY/deck | app/scripts/modules/core/src/pipeline/triggers/NextRunTag.tsx | TypeScript |
ClassDeclaration |
export class NextRunTag extends React.Component<INextRunTagProps, INextRunTagState> {
constructor(props: INextRunTagProps) {
super(props);
this.state = this.updateSchedule();
}
private updateSchedule(): INextRunTagState {
if (this.props.pipeline) {
const crons = (this.props.pipeline.triggers ... | CODY-RAY/deck | app/scripts/modules/core/src/pipeline/triggers/NextRunTag.tsx | TypeScript |
InterfaceDeclaration |
export interface INextRunTagProps {
pipeline: IPipeline;
} | CODY-RAY/deck | app/scripts/modules/core/src/pipeline/triggers/NextRunTag.tsx | TypeScript |
InterfaceDeclaration |
export interface INextRunTagState {
nextScheduled: number;
hasNextScheduled: boolean;
} | CODY-RAY/deck | app/scripts/modules/core/src/pipeline/triggers/NextRunTag.tsx | TypeScript |
MethodDeclaration |
private updateSchedule(): INextRunTagState {
if (this.props.pipeline) {
const crons = (this.props.pipeline.triggers || []).filter(
(t: ICronTrigger) => t.type === 'cron' && t.enabled && t.cronExpression,
) as ICronTrigger[];
const nextTimes: number[] = [];
crons.forEach(cron => {
... | CODY-RAY/deck | app/scripts/modules/core/src/pipeline/triggers/NextRunTag.tsx | TypeScript |
MethodDeclaration |
public render(): React.ReactElement<NextRunTag> {
const nextDuration = relativeTime(this.state.nextScheduled);
const visible = !this.props.pipeline.disabled && this.state.hasNextScheduled;
return (
<span style={{ visibility: visible ? 'visible' : 'hidden' }} | CODY-RAY/deck | app/scripts/modules/core/src/pipeline/triggers/NextRunTag.tsx | TypeScript |
FunctionDeclaration |
export function createSchemaField<Components extends SchemaReactComponents>(
options: ISchemaFieldReactFactoryOptions<Components> = {}
) {
function SchemaField<
Decorator extends JSXComponent,
Component extends JSXComponent
>(props: ISchemaFieldProps<Decorator, Component>) {
const schema = Schema.isS... | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
FunctionDeclaration |
function SchemaField<
Decorator extends JSXComponent,
Component extends JSXComponent
>(props: ISchemaFieldProps<Decorator, Component>) {
const schema = Schema.isSchemaInstance(props.schema)
? props.schema
: new Schema({
type: 'object',
...props.schema,
})
const... | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
FunctionDeclaration |
function MarkupField<
Decorator extends ReactComponentPath<Components>,
Component extends ReactComponentPath<Components>
>(props: ISchemaMarkupFieldProps<Components, Component, Decorator>) {
const parent = useContext(SchemaMarkupContext)
if (!parent) return <Fragment />
const renderChildren = () ... | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
FunctionDeclaration |
function StringField<
Decorator extends ReactComponentPath<Components>,
Component extends ReactComponentPath<Components>
>(props: ISchemaTypeFieldProps<Components, Component, Decorator>) {
return <MarkupField {...props} type="string" />
} | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
FunctionDeclaration |
function ObjectField<
Decorator extends ReactComponentPath<Components>,
Component extends ReactComponentPath<Components>
>(props: ISchemaTypeFieldProps<Components, Component, Decorator>) {
return <MarkupField {...props} type="object" />
} | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
FunctionDeclaration |
function ArrayField<
Decorator extends ReactComponentPath<Components>,
Component extends ReactComponentPath<Components>
>(props: ISchemaTypeFieldProps<Components, Component, Decorator>) {
return <MarkupField {...props} type="array" />
} | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
FunctionDeclaration |
function BooleanField<
Decorator extends ReactComponentPath<Components>,
Component extends ReactComponentPath<Components>
>(props: ISchemaTypeFieldProps<Components, Component, Decorator>) {
return <MarkupField {...props} type="boolean" />
} | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
FunctionDeclaration |
function NumberField<
Decorator extends ReactComponentPath<Components>,
Component extends ReactComponentPath<Components>
>(props: ISchemaTypeFieldProps<Components, Component, Decorator>) {
return <MarkupField {...props} type="number" />
} | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
FunctionDeclaration |
function DateField<
Decorator extends ReactComponentPath<Components>,
Component extends ReactComponentPath<Components>
>(props: ISchemaTypeFieldProps<Components, Component, Decorator>) {
return <MarkupField {...props} type="date" />
} | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
FunctionDeclaration |
function DateTimeField<
Decorator extends ReactComponentPath<Components>,
Component extends ReactComponentPath<Components>
>(props: ISchemaTypeFieldProps<Components, Component, Decorator>) {
return <MarkupField {...props} type="datetime" />
} | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
FunctionDeclaration |
function VoidField<
Decorator extends ReactComponentPath<Components>,
Component extends ReactComponentPath<Components>
>(props: ISchemaTypeFieldProps<Components, Component, Decorator>) {
return <MarkupField {...props} type="void" />
} | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
ArrowFunction |
() => {
return `NO_NAME_FIELD_$${env.nonameId++}`
} | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
ArrowFunction |
() => {
env.nonameId = 0
if (props.schema) return null
return render(
<SchemaMarkupContext.Provider value={schema}>
{props.children}
</SchemaMarkupContext.Provider>
)
} | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
ArrowFunction |
() => {
return <RecursionField {...props} schema={schema} />
} | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
ArrowFunction |
() => {
return <React.Fragment>{props.children}</React.Fragment>
} | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
ArrowFunction |
(schema: ISchema) => {
if (parent.items) {
return parent.addProperty(name, schema)
} else {
return parent.setItems(props)
}
} | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
MethodDeclaration |
renderMarkup() | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
MethodDeclaration |
renderChildren() | sqlwwx/formily | packages/react/src/components/SchemaField.tsx | TypeScript |
ArrowFunction |
({ navigation }) => {
const { t } = useTranslation()
const dispatch = useDispatch()
const [loading, setLoading] = useState(true);
const temp_state = useSelector((state) => state)
console.log("Full state", temp_state)
useEffect(() => {
const fetchData = async () => {
setLoading(true)
... | okos-jordan/react-native-boilerplate | okos_smart_control/src/Containers/Home/Index.tsx | TypeScript |
ArrowFunction |
(state) => state | okos-jordan/react-native-boilerplate | okos_smart_control/src/Containers/Home/Index.tsx | TypeScript |
ArrowFunction |
() => {
const fetchData = async () => {
setLoading(true)
console.log("FETCHING ENTITIES: ")
let data = await GetEntities()
dispatch(UpdateEntities.action({ 'entities': data } ))
}
fetchData()
} | okos-jordan/react-native-boilerplate | okos_smart_control/src/Containers/Home/Index.tsx | TypeScript |
ArrowFunction |
async () => {
setLoading(true)
console.log("FETCHING ENTITIES: ")
let data = await GetEntities()
dispatch(UpdateEntities.action({ 'entities': data } ))
} | okos-jordan/react-native-boilerplate | okos_smart_control/src/Containers/Home/Index.tsx | TypeScript |
ArrowFunction |
(state: { entities: EntitiesState }) => state.entities.entities | okos-jordan/react-native-boilerplate | okos_smart_control/src/Containers/Home/Index.tsx | TypeScript |
ArrowFunction |
() => navigation.navigate('Settings') | okos-jordan/react-native-boilerplate | okos_smart_control/src/Containers/Home/Index.tsx | TypeScript |
ArrowFunction |
(entities) => {
return entities.filter(entity => {
let type = entity.entity_id.split('.')[0]
if (entityTypeList.includes(type)){
return true
} else {
return false
}
})
} | okos-jordan/react-native-boilerplate | okos_smart_control/src/Containers/Home/Index.tsx | TypeScript |
ArrowFunction |
entity => {
let type = entity.entity_id.split('.')[0]
if (entityTypeList.includes(type)){
return true
} else {
return false
}
} | okos-jordan/react-native-boilerplate | okos_smart_control/src/Containers/Home/Index.tsx | TypeScript |
ArrowFunction |
({ item }: any) => (
<TouchableOpacity style={styles.item} | okos-jordan/react-native-boilerplate | okos_smart_control/src/Containers/Home/Index.tsx | TypeScript |
FunctionDeclaration | /**
* Property reference resolver (method) Decorator.
*/
export function ResolveReferenceLoader(): MethodDecorator {
return (
target: Function | Object,
key?: string | symbol,
descriptor?: any,
) => {
SetMetadata(RESOLVER_REFERENCE_METADATA, true)(target, key, descriptor);
SetMetadata(REFERENC... | Davide-Gheri/nestjs-mercurius | lib/decorators/resolve-reference-loader.decorator.ts | TypeScript |
ArrowFunction |
(
target: Function | Object,
key?: string | symbol,
descriptor?: any,
) => {
SetMetadata(RESOLVER_REFERENCE_METADATA, true)(target, key, descriptor);
SetMetadata(REFERENCE_LOADER_METADATA, true)(target, key, descriptor);
SetMetadata(LOADER_PROPERTY_METADATA, true)(target, key, descriptor);
... | Davide-Gheri/nestjs-mercurius | lib/decorators/resolve-reference-loader.decorator.ts | TypeScript |
ClassDeclaration |
@Injectable({
providedIn: 'root'
})
export class PlayerService {
constructor () {
}
public play(url : string, descriptions : string[], src : string) {
PlayerComponent.setDescriptions(descriptions[0], descriptions[1]);
PlayerComponent.setUrl(url);
PlayerComponent.setSrc(src);
const xhr = new XM... | iTrixPro/music-player | src/app/player/player.service.ts | TypeScript |
MethodDeclaration |
public play(url : string, descriptions : string[], src : string) {
PlayerComponent.setDescriptions(descriptions[0], descriptions[1]);
PlayerComponent.setUrl(url);
PlayerComponent.setSrc(src);
const xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.withCredentials = true;
xhr.send(... | iTrixPro/music-player | src/app/player/player.service.ts | TypeScript |
ArrowFunction |
() => {
let component: FieldWithPrefixAndSuffixComponent;
let fixture: ComponentFixture<FieldWithPrefixAndSuffixComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FieldWithPrefixAndSuffixComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fi... | A-l-y-l-e/Alyle-UI | src/app/docs/components/field-demo/field-with-prefix-and-suffix/field-with-prefix-and-suffix.component.spec.ts | TypeScript |
ArrowFunction |
() => {
TestBed.configureTestingModule({
declarations: [ FieldWithPrefixAndSuffixComponent ]
})
.compileComponents();
} | A-l-y-l-e/Alyle-UI | src/app/docs/components/field-demo/field-with-prefix-and-suffix/field-with-prefix-and-suffix.component.spec.ts | TypeScript |
ArrowFunction |
() => {
fixture = TestBed.createComponent(FieldWithPrefixAndSuffixComponent);
component = fixture.componentInstance;
fixture.detectChanges();
} | A-l-y-l-e/Alyle-UI | src/app/docs/components/field-demo/field-with-prefix-and-suffix/field-with-prefix-and-suffix.component.spec.ts | TypeScript |
ArrowFunction |
() => {
const dataCount = paginatedMap.value.size
return dataCount === 0 || dataCount === currentPageRowKeys.value.disabledRowKeys.length
} | CruellyJoHn/components | packages/components/table/src/main/head/HeadCellSelectable.tsx | TypeScript |
ArrowFunction |
() => {
const { multiple } = selectable.value!
if (!multiple) {
return undefined
}
const children: VNodeTypes[] = []
const checked = currentPageAllSelected.value
const indeterminate = currentPageSomeSelected.value
const checkboxProps = { checked, indeterminate, disable... | CruellyJoHn/components | packages/components/table/src/main/head/HeadCellSelectable.tsx | TypeScript |
ArrowFunction |
option => (
<IxMenuItem {...option}></IxMenuItem>
) | CruellyJoHn/components | packages/components/table/src/main/head/HeadCellSelectable.tsx | TypeScript |
ArrowFunction |
() => trigger | CruellyJoHn/components | packages/components/table/src/main/head/HeadCellSelectable.tsx | TypeScript |
MethodDeclaration |
setup() {
const {
paginatedMap,
selectable,
currentPageRowKeys,
currentPageAllSelected,
currentPageSomeSelected,
handleHeadSelectChange,
mergedSelectableOptions,
} = inject(TABLE_TOKEN)!
const disabled = computed(() => {
const dataCount = paginatedMap.value.... | CruellyJoHn/components | packages/components/table/src/main/head/HeadCellSelectable.tsx | TypeScript |
ArrowFunction |
(type: string): boolean =>
type === 'ordered-list-item' || type === 'unordered-list-item' | wix-incubator/rich-content-editor | packages/ricos-content/web/src/consts.ts | TypeScript |
ClassDeclaration |
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class HostingRoutingModule { } | echiechi/sparktemplate | src/app/hosting/hosting-routing.module.ts | TypeScript |
InterfaceDeclaration |
export interface GameWindow extends Window {
game: Phaser.Game;
cordova: Object;
} | jakubzet/phaser3-typescript-boilerplate | src/interfaces.ts | TypeScript |
InterfaceDeclaration |
export interface CordovaApp {
initialize: () => void;
onDeviceReady: () => void;
receivedEvent: (id: string) => void;
} | jakubzet/phaser3-typescript-boilerplate | src/interfaces.ts | TypeScript |
InterfaceDeclaration |
export interface ControlsScheme {
left: Phaser.Input.Keyboard.Key;
up: Phaser.Input.Keyboard.Key;
right: Phaser.Input.Keyboard.Key;
down: Phaser.Input.Keyboard.Key;
} | jakubzet/phaser3-typescript-boilerplate | src/interfaces.ts | TypeScript |
ArrowFunction |
() => {
const { elements, ref } = useElements();
return (
<TestLayout elements={elements}>
<SvgLink />
<div ref={ref}>
<Svg />
</div>
</TestLayout> | arvinxx/html2sketch | docs/e2e/svg/demos/SvgUseSymbol.tsx | TypeScript |
ArrowFunction |
(value: number) => {
return value >= Int6.min && value <= Int6.max;
} | vickylance/nengi | core/binary/types/Int6.ts | TypeScript |
ClassDeclaration |
export class Text extends Base {
private textContent = '';
private multiline = false;
textDecoration: TextDecoration | null;
fontSize: number;
set text(text: string) { this.textContent = fixWhiteSpace(text, this.styles.whiteSpace); }
get text(): string { return this.textContent; }
constructor(bounding:... | Dynatrace/sketchmine | packages/sketch-file-format/src/models/text.ts | TypeScript |
MethodDeclaration |
addParagraphStyle(): SketchParagraphStyle {
const lh = this.styles.lineHeight;
const display = this.styles.display;
/**
* When the font size is normal the browser sets it of 1.2 of the font size:
* @see https://www.w3.org/TR/CSS22/visudet.html#line-height
*/
const lineHeight = (lh === 'no... | Dynatrace/sketchmine | packages/sketch-file-format/src/models/text.ts | TypeScript |
MethodDeclaration |
addUnderline(): number {
if (this.textDecoration && this.textDecoration.type === 'underline') {
switch (this.textDecoration.style) {
case 'double': return UnderlineStyle.Double;
case 'solid': return UnderlineStyle.Underline;
}
}
return UnderlineStyle.None;
} | Dynatrace/sketchmine | packages/sketch-file-format/src/models/text.ts | TypeScript |
MethodDeclaration |
addStrikeThrough(): number {
if (this.textDecoration && this.textDecoration.type === 'line-through') {
return StrikethroughStyle.LineThrough;
}
return StrikethroughStyle.None;
} | Dynatrace/sketchmine | packages/sketch-file-format/src/models/text.ts | TypeScript |
MethodDeclaration |
addKerning(): number | undefined {
let kerning;
if (this.styles.letterSpacing !== 'normal') {
kerning = parseFloat(this.styles.letterSpacing);
}
return kerning;
} | Dynatrace/sketchmine | packages/sketch-file-format/src/models/text.ts | TypeScript |
MethodDeclaration |
addTextTransform(): number {
switch (this.styles.textTransform) {
case 'uppercase':
return TextTransform.Uppercase;
case 'lowercase':
return TextTransform.Lowercase;
default:
return TextTransform.None;
}
} | Dynatrace/sketchmine | packages/sketch-file-format/src/models/text.ts | TypeScript |
MethodDeclaration |
addParagraphSpacing(): number | undefined {
// TODO: lukas.holzer need to implement
return undefined;
} | Dynatrace/sketchmine | packages/sketch-file-format/src/models/text.ts | TypeScript |
MethodDeclaration |
createFontDescriptor(): SketchFontDescriptor {
const fontFamily = this.styles.fontFamily.split(',')[0];
const fontWeight = this.styles.fontWeight;
const fontVariant = this.styles.fontStyle as fontStyle;
return {
_class: SketchObjectTypes.FontDescriptor,
attributes: {
name: fontMapp... | Dynatrace/sketchmine | packages/sketch-file-format/src/models/text.ts | TypeScript |
MethodDeclaration |
createTextStyleAttributes() : SketchEncodedAttributes {
return {
kerning: this.addKerning(),
MSAttributedStringColorAttribute: colorToSketchColor(this.styles.color),
MSAttributedStringFontAttribute: this.createFontDescriptor(),
MSAttributedStringTextTransformAttribute: this.addTextTransform... | Dynatrace/sketchmine | packages/sketch-file-format/src/models/text.ts | TypeScript |
MethodDeclaration |
createAttribute(location: number, length: number): SketchAttribute {
return {
_class: SketchObjectTypes.StringAttribute,
location,
length,
attributes: this.createTextStyleAttributes(),
};
} | Dynatrace/sketchmine | packages/sketch-file-format/src/models/text.ts | TypeScript |
MethodDeclaration |
createAttributedString(): SketchAttributedString {
return {
_class: SketchObjectTypes.AttributedString,
string: `${this.textContent}`,
attributes: [
this.createAttribute(0, this.textContent.length),
],
};
} | Dynatrace/sketchmine | packages/sketch-file-format/src/models/text.ts | TypeScript |
MethodDeclaration |
addTextStyle(): SketchTextStyle {
return {
_class: SketchObjectTypes.TextStyle,
encodedAttributes: this.createTextStyleAttributes(),
verticalAlignment: 0,
};
} | Dynatrace/sketchmine | packages/sketch-file-format/src/models/text.ts | TypeScript |
MethodDeclaration |
generateGlyphBounds(frame: SketchFrame): string {
let height = frame.height;
// if style display inline the bounding client gets ignored for the size
if (this.styles.display === 'inline') {
height = Math.ceil(this.fontSize * 1.2);
}
return `{{${frame.x}, ${frame.y}}, {${frame.width}, ${heig... | Dynatrace/sketchmine | packages/sketch-file-format/src/models/text.ts | TypeScript |
MethodDeclaration |
generateObject(): SketchText {
const base: SketchBase = super.generateObject();
base.style = new Style().generateObject();
base.style.textStyle = this.addTextStyle();
const frame = super.addFrame();
if (frame.height > parseInt(this.styles.lineHeight, 10)) {
this.multiline = true;
}
... | Dynatrace/sketchmine | packages/sketch-file-format/src/models/text.ts | TypeScript |
ArrowFunction |
({ obj: pipeline }) => {
const routeTemplates: RouteTemplate[] = usePipelineTriggerTemplateNames(pipeline) || [];
const taskLinks = pipeline.spec.tasks
.filter((pipelineTask: PipelineTask) => !!pipelineTask.taskRef)
.map((task) => ({
model: getResourceModelFromTaskKind(task.taskRef.kind),
name:... | benjaminapetersen/console | frontend/packages/dev-console/src/components/pipelines/detail-page-tabs/pipeline-details/PipelineDetails.tsx | TypeScript |
ArrowFunction |
(pipelineTask: PipelineTask) => !!pipelineTask.taskRef | benjaminapetersen/console | frontend/packages/dev-console/src/components/pipelines/detail-page-tabs/pipeline-details/PipelineDetails.tsx | TypeScript |
ArrowFunction |
(task) => ({
model: getResourceModelFromTaskKind(task.taskRef.kind),
name: task.taskRef.name,
displayName: task.name,
}) | benjaminapetersen/console | frontend/packages/dev-console/src/components/pipelines/detail-page-tabs/pipeline-details/PipelineDetails.tsx | TypeScript |
InterfaceDeclaration |
interface PipelineDetailsProps {
obj: Pipeline;
} | benjaminapetersen/console | frontend/packages/dev-console/src/components/pipelines/detail-page-tabs/pipeline-details/PipelineDetails.tsx | TypeScript |
FunctionDeclaration |
export function areEqual(obj1, obj2) {
return Object.keys(obj1).every(
key => obj2.hasOwnProperty(key) && obj1[key] === obj2[key]
);
} | Flash-Git/aurelia-contact-manager | src/utility.ts | TypeScript |
ArrowFunction |
key => obj2.hasOwnProperty(key) && obj1[key] === obj2[key] | Flash-Git/aurelia-contact-manager | src/utility.ts | TypeScript |
FunctionDeclaration |
export function trackingMechanics() {
type Session<xState, X> = {observer: Observer<xState, X>, reaction?: Reaction<X>}
let activeWatch: {
identifier: symbol
session: Session<any, any>
}
const sessions = new Map<string, Map<symbol, Session<any, any>>>()
function unsubscribe(identifier: symbol) {
for (co... | PaulAroo/app-template | s/toolbox/madstate/parts/tracking-mechanics.ts | TypeScript |
FunctionDeclaration |
function unsubscribe(identifier: symbol) {
for (const [,record] of sessions)
record.delete(identifier)
} | PaulAroo/app-template | s/toolbox/madstate/parts/tracking-mechanics.ts | TypeScript |
ArrowFunction |
() => unsubscribe(identifier) | PaulAroo/app-template | s/toolbox/madstate/parts/tracking-mechanics.ts | TypeScript |
ArrowFunction |
() => {
const reactionsQueue: Set<string> = new Set()
const fireReactionsQueue = debounce3(debounceDelay, <xState>(state: Readable<xState>) => {
for (const key of reactionsQueue) {
for (const [,{observer, reaction}] of sessions.get(key) ?? []) {
if (reaction) reaction(observer(state))
else o... | PaulAroo/app-template | s/toolbox/madstate/parts/tracking-mechanics.ts | TypeScript |
ArrowFunction |
<xState>(state: Readable<xState>) => {
for (const key of reactionsQueue) {
for (const [,{observer, reaction}] of sessions.get(key) ?? []) {
if (reaction) reaction(observer(state))
else observer(state)
}
}
reactionsQueue.clear()
} | PaulAroo/app-template | s/toolbox/madstate/parts/tracking-mechanics.ts | TypeScript |
ArrowFunction |
<xState>(state: Readable<xState>, key: string) => {
reactionsQueue.add(key)
const promise = fireReactionsQueue(state)
waiter = waiter.then(() => promise)
} | PaulAroo/app-template | s/toolbox/madstate/parts/tracking-mechanics.ts | TypeScript |
ArrowFunction |
() => promise | PaulAroo/app-template | s/toolbox/madstate/parts/tracking-mechanics.ts | TypeScript |
TypeAliasDeclaration |
type Session<xState, X> = {observer: Observer<xState, X>, reaction?: Reaction<X>} | PaulAroo/app-template | s/toolbox/madstate/parts/tracking-mechanics.ts | TypeScript |
MethodDeclaration |
track<xState, X>(state: Readable<xState>, observer: Observer<xState, X>, reaction?: Reaction<X>) {
const identifier = Symbol()
activeWatch = {identifier, session: {observer, reaction}}
observer(state)
activeWatch = undefined
return () => unsubscribe(identifier)
} | PaulAroo/app-template | s/toolbox/madstate/parts/tracking-mechanics.ts | TypeScript |
MethodDeclaration |
avoidCircular(key: string) {
if (activeWatch)
throw new MadstateCircularError(`cannot set any properties within a reaction, not even "${key}"`)
} | PaulAroo/app-template | s/toolbox/madstate/parts/tracking-mechanics.ts | TypeScript |
MethodDeclaration |
reactionRegistration(key: string) {
if (activeWatch) {
let record = sessions.get(key)
if (!record) {
record = new Map()
sessions.set(key, record)
}
record.set(activeWatch.identifier, activeWatch.session)
}
} | PaulAroo/app-template | s/toolbox/madstate/parts/tracking-mechanics.ts | TypeScript |
FunctionDeclaration |
export function properties(): string[] {
if (!_properties) {
const pseudoInstance: RxDatabaseBase = new (RxDatabaseBase as any)();
const ownProperties = Object.getOwnPropertyNames(pseudoInstance);
const prototypeProperties = Object.getOwnPropertyNames(
Object.getPrototypeOf(pseu... | 404-not-find/rxdb | src/rx-database.ts | TypeScript |
FunctionDeclaration | /**
* checks if an instance with same name and adapter already exists
* @throws {RxError} if used
*/
function _isNameAdapterUsed(
name: string,
adapter: any
) {
if (!USED_COMBINATIONS[name])
return false;
let used = false;
USED_COMBINATIONS[name].forEach(ad => {
if (ad === adapte... | 404-not-find/rxdb | src/rx-database.ts | TypeScript |
FunctionDeclaration |
function _removeUsedCombination(name: string, adapter: any) {
if (!USED_COMBINATIONS[name])
return;
const index = USED_COMBINATIONS[name].indexOf(adapter);
USED_COMBINATIONS[name].splice(index, 1);
} | 404-not-find/rxdb | src/rx-database.ts | TypeScript |
FunctionDeclaration | /**
* validates and inserts the password-hash
* to ensure there is/was no other instance with a different password
*/
export function _preparePasswordHash(
rxDatabase: RxDatabase
): Promise<boolean> {
if (!rxDatabase.password) return Promise.resolve(false);
const pwHash = hash(rxDatabase.password);
... | 404-not-find/rxdb | src/rx-database.ts | TypeScript |
FunctionDeclaration | /**
* to not confuse multiInstance-messages with other databases that have the same
* name and adapter, but do not share state with this one (for example in-memory-instances),
* we set a storage-token and use it in the broadcast-channel
*/
export function _ensureStorageTokenExists(rxDatabase: RxDatabase): Promise<s... | 404-not-find/rxdb | src/rx-database.ts | TypeScript |
FunctionDeclaration | /**
* writes the changeEvent to the broadcastChannel
*/
export function writeToSocket(
rxDatabase: RxDatabase,
changeEvent: RxChangeEvent
): Promise<boolean> {
if (
rxDatabase.multiInstance &&
!changeEvent.isIntern() &&
rxDatabase.broadcastChannel
) {
const socketDoc =... | 404-not-find/rxdb | src/rx-database.ts | TypeScript |
FunctionDeclaration | /**
* returns the primary for a given collection-data
* used in the internal pouchdb-instances
*/
export function _collectionNamePrimary(name: string, schema: RxJsonSchema) {
return name + '-' + schema.version;
} | 404-not-find/rxdb | src/rx-database.ts | TypeScript |
FunctionDeclaration | /**
* removes all internal docs of a given collection
* @return resolves all known collection-versions
*/
export function _removeAllOfCollection(
rxDatabase: RxDatabase,
collectionName: string
): Promise<number[]> {
return rxDatabase.lockedRun(
() => (rxDatabase._collectionsPouch as any).allDocs... | 404-not-find/rxdb | src/rx-database.ts | TypeScript |
FunctionDeclaration |
function _prepareBroadcastChannel(rxDatabase: RxDatabase) {
// broadcastChannel
rxDatabase.broadcastChannel = new BroadcastChannel(
'RxDB:' +
rxDatabase.name + ':' +
'socket'
);
rxDatabase.broadcastChannel$ = new Subject();
rxDatabase.broadcastChannel.onmessage = msg => {
... | 404-not-find/rxdb | src/rx-database.ts | TypeScript |
FunctionDeclaration | /**
* do the async things for this database
*/
function prepare(rxDatabase: RxDatabase): Promise<void> {
rxDatabase._adminPouch = _internalAdminPouch(rxDatabase.name, rxDatabase.adapter, rxDatabase.pouchSettings);
rxDatabase._collectionsPouch = _internalCollectionsPouch(rxDatabase.name, rxDatabase.adapter, rx... | 404-not-find/rxdb | src/rx-database.ts | TypeScript |
FunctionDeclaration |
export function create<Collections = { [key: string]: RxCollection }>({
name,
adapter,
password,
multiInstance = true,
queryChangeDetection = false,
ignoreDuplicate = false,
options = {},
pouchSettings = {}
}: RxDatabaseCreator): Promise<RxDatabase<Collections>> {
validateCouchDBStr... | 404-not-find/rxdb | src/rx-database.ts | TypeScript |
FunctionDeclaration |
export function getPouchLocation(
dbName: string,
collectionName: string,
schemaVersion: number
) {
const prefix = dbName + '-rxdb-' + schemaVersion + '-';
if (!collectionName.includes('/')) {
return prefix + collectionName;
} else {
// if collectionName is a path, we have to pr... | 404-not-find/rxdb | src/rx-database.ts | TypeScript |
FunctionDeclaration |
function _spawnPouchDB(
dbName: string,
adapter: any,
collectionName: string,
schemaVersion: number,
pouchSettings: PouchSettings = {},
pouchSettingsFromRxDatabaseCreator: PouchSettings = {}
): PouchDBInstance {
const pouchLocation = getPouchLocation(dbName, collectionName, schemaVersion);
... | 404-not-find/rxdb | src/rx-database.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.