Skip to content

Instantly share code, notes, and snippets.

View fireflysemantics's full-sized avatar

Firefly Semantics Corporation fireflysemantics

View GitHub Profile
/**
* @param scrollable The element being scrolled
* @param debounceMS The number of milliseconds to debounce scroll events
* @param sp The function returning the scroll position coordinates.
* @return A boolean valued observable indicating whether the element is scrolling up or down
*/
export function scrollingUp(
scrollable: any,
debounceMS: number,
sp: scrollPosition): Observable<boolean> {
import { ACTIVE_MENU_KEY, MENU_ITEMS } from './model';
import { Injectable, OnDestroy } from '@angular/core';
import { OStore} from "@fireflysemantics/slice";
import { Observable } from "rxjs";
@Injectable({
providedIn: 'root'
})
export class StateService {
public ostore:OStore = new OStore();
import { Component } from '@angular/core'
import { FormControl } from '@angular/forms'
import { StateService } from './state.service'
import { ACTIVE_MENU_KEY, MENU_ITEMS, MENU_ITEM_VALUES } from './model'
@Component({
selector: 'fs-menu',
template: `
<button mat-icon-button [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
<mat-form-field floatLabel="never">
<input matInput
#searchInput="matInput"
type="text"
placeholder="Search"
[value]="appState.todoStore.query"
(keyup)="appState.search($event.target.value)"
autocomplete="off"/>
<mat-icon [color]="searchInput.focused ? 'primary' : ''"
matSuffix>search</mat-icon>
import { Injectable, OnDestroy } from '@angular/core'
import { OStore} from '@fireflysemantics/slice'
import { Observable } from 'rxjs'
import { MenuItems} from './model'
import { untilDestroyed } from 'ngx-take-until-destroy'
export const ACTIVE_MENU = "ACTIVE_MENU"
export const AUTHENTICATED = "AUTHENTICATED"
export const SAVED = "SAVED"
import { Component } from '@angular/core'
import { AppStateService, ACTIVE_MENU, AUTHENTICATED } from './app-state.service'
import { MenuItems, MENU_LABELS } from './model'
@Component({
selector: 'fs-menu',
template: `
<button mat-icon-button [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
/*
* Class mapped to the the contacts table in db.ts by the line:
* db.contacts.mapToClass(Contact)
*/
export class Contact {
id: string;
firstName: string;
lastName: string;
emails: IEmailAddress[];
phones: IPhoneNumber[];
import Dexie from 'dexie';
import { IEmailAddress,
IPhoneNumber,
Contact } from './model';
export class AppDatabase extends Dexie {
public contacts: Dexie.Table<Contact, string>
public emails: Dexie.Table<IEmailAddress, string>
/*
* Class mapped to the the contacts table in db.ts by the line:
* db.contacts.mapToClass(Contact)
*/
export class Contact extends AbstractEntity {
emails: EmailAddress[]
phones: PhoneNumber[]
constructor(
public firstName: string,
import Dexie from 'dexie';
import { EmailAddress,
PhoneNumber,
Contact } from './model';
export class AppDatabase extends Dexie {
public contacts: Dexie.Table<Contact, string>
public emails: Dexie.Table<EmailAddress, number>