repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
mwilliamson/Stopify | normalize-js/ts/nameExprs.ts | import { NodePath, Visitor } from 'babel-traverse';
import * as t from 'babel-types';
import { fresh } from '@stopify/hygiene';
const names: Visitor = {
ObjectMethod: function (path: NodePath<t.ObjectMethod>): void {
if (path.node.kind === "method") {
let fun = t.functionExpression(fresh('method'),
... |
mwilliamson/Stopify | stopify/src/compiler/common.ts | <filename>stopify/src/compiler/common.ts
import * as t from 'babel-types';
export const $S = t.identifier('$S');
export const $S_g = t.memberExpression($S, t.identifier('g'), false);
|
mwilliamson/Stopify | stopify-higher-order-functions/ts/index.ts | <reponame>mwilliamson/Stopify
/**
* A very simple visitor that adds support for higher-order functions by
* passing literal values to wrapper functions in the runtime system. The
* wrappers rely on sub-classing builtin types (a relatively recent feature
* of JavaScript). We do not bother changes references to const... |
mwilliamson/Stopify | stopify/test/sanity.test.ts | <filename>stopify/test/sanity.test.ts<gh_stars>100-1000
import * as f from './testFixtures.js';
import * as fs from 'fs';
const assert = require('assert');
// NOTE(rachit): Don't use arrow functions, otherwise timeout doesn't work.
describe('Sanity check -- All tests pass without plugins', function () {
f.unitTest... |
mwilliamson/Stopify | stopify-estimators/src/elapsedTimeEstimator.ts | /**
* Interface for an object that estimates elapsed time.
*/
export abstract class ElapsedTimeEstimator {
/**
* See 'elapsedTime' documentation.
*/
abstract reset(): void;
/** Produces an estimate of time elapsed, in milliseconds, since the last
* application of 'reset' or since the object was created... |
mwilliamson/Stopify | util/ts/babelHelpers.ts | <filename>util/ts/babelHelpers.ts
import { NodePath } from 'babel-traverse';
import * as t from 'babel-types';
export type FunWithBody = t.FunctionDeclaration | t.FunctionExpression |
t.ObjectMethod;
export function isFunWithBody(node: t.Node): node is FunWithBody {
return t.isFunctionDeclaration(node) || t.isFun... |
mwilliamson/Stopify | stopify/src/runInBrowser.ts | <gh_stars>100-1000
/**
* This program uses Selenium to run a Stopify benchmark in a browser.
*
* There are a few steps involved:
*
* 1. We serve the dist/ directory and the directory containing the benchmark
* on port 9999.
*
* 2. We use Selenium to start a browser (in headless mode, if we know how).
*
* 3... |
mwilliamson/Stopify | stopify/src/runtime/check-runtime-opts.ts | import { RuntimeOpts } from '../types';
import { copyProp, transformProp } from
'@stopify/continuations/dist/src/compiler/check-compiler-opts';
const validFlags = [
'filename',
'estimator',
'yieldInterval',
'resampleInterval',
'timePerElapsed',
'stop',
'variance',
'env',
'stackSize',
'restoreFram... |
mwilliamson/Stopify | normalize-js/ts/cleanup.ts | <filename>normalize-js/ts/cleanup.ts<gh_stars>100-1000
/**
* This plugin cleans up JavaScript code to conform to ES5 strict mode.
* It does the following:
*
* 1. Eliminate arguments.callee
*
*/
import { NodePath } from 'babel-traverse';
import * as t from 'babel-types';
import { fresh } from '@stopify/hygiene';
... |
mwilliamson/Stopify | stopify-continuations/src/types.ts | <filename>stopify-continuations/src/types.ts
export type KFrame = KFrameTop | KFrameRest;
export interface KFrameTop {
kind: 'top';
f: () => any;
this: any;
}
export interface KFrameRest {
kind: 'rest';
f: () => any; // The function we are in
locals: any[]; // All locals
params: any[]; // All params... |
mwilliamson/Stopify | stopify-continuations-compiler/src/runtime/implicitApps.ts | type Prim = number | string | boolean | null | undefined;
function toPrimitive(x: any): Prim {
// TODO(arjun): This isn't exactly the right order.
if (typeof x === 'object' && x !== 'null') {
let v = x.valueOf();
if (typeof v === 'object' && v !== 'null') {
v = x.toString();
if (typeof v === 'ob... |
mwilliamson/Stopify | stopify-continuations-compiler/src/common/desugarNew.ts | <gh_stars>100-1000
/**
* This transformation converts all instances of `new` to a function
* call. Note that the handler itself stil has a `new` expression to deal
* with native constructors.
*/
import { NodePath } from 'babel-traverse';
import { letExpression } from '@stopify/util';
import { FlatnessMark } from ... |
mwilliamson/Stopify | stopify/src/stopify/compileFunction.ts | <gh_stars>100-1000
/**
* `func` compile mode should be used when function bodies need to be compiled
* while preserving the function signatures. This is currently being used in
* the pyret compiler.
*
* This passes around information to make sure that:
* - the function signature is preserved
* - globals are not ... |
mwilliamson/Stopify | stopify/src/parse-runtime-opts.ts | <reponame>mwilliamson/Stopify<filename>stopify/src/parse-runtime-opts.ts
import * as commander from 'commander';
import { RuntimeOpts } from './types';
import { checkAndFillRuntimeOpts } from './runtime/check-runtime-opts';
commander.option(
'-y, --yield <interval>',
'time (in milliseconds) between yields to the e... |
mwilliamson/Stopify | normalize-js/ts/anf.ts | /**
* Plugin to transform JS programs into ANF form.
*
* WARNING:
* The plugin assumes that the assumptions stated in ./src/desugarLoop.js
* hold. The resulting output is not guarenteed to be in ANF form if the
* assumptions do not hold.
*/
import { NodePath, Visitor } from 'babel-traverse';
import * as t from ... |
mwilliamson/Stopify | hygiene/hygiene.test.ts | <gh_stars>100-1000
import * as babel from 'babel-core';
import { NodePath } from 'babel-traverse';
import * as t from 'babel-types';
import { hygiene as Hygiene, fastFreshId } from '@stopify/normalize-js';
const assert = require('assert');
interface Args {
reserved: Set<string>
}
const visitor = {
BindingIdentif... |
mwilliamson/Stopify | stopify/src/generic.ts | export function sum(arr: number[]): number {
return arr.reduce((x, y) => x + y, 0);
}
export function dropWhile<T>(f: (elt: T) => boolean, arr: T[]): T[] {
for (let i = 0; i < arr.length; i++) {
if (f(arr[i]) === false) {
return arr.slice(i);
}
}
return [];
}
export function takeWhile<T>(f: (elt... |
mwilliamson/Stopify | stopify/src/stopify/suspendStep.ts | import { NodePath, Visitor } from 'babel-traverse';
import * as t from 'babel-types';
import { CompilerOpts } from '@stopify/continuations';
function insertSuspendHelper(body: t.Statement[], opts: CompilerOpts) {
const newBody: t.Statement[] = [];
(<any>newBody).suspends = false;
body.forEach((v, i) => {
con... |
mwilliamson/Stopify | stopify/src/runtime/suspend.ts | <reponame>mwilliamson/Stopify
import { setImmediate } from './setImmediate';
import { ElapsedTimeEstimator } from '@stopify/estimators';
import { Runtime, Result } from '@stopify/continuations-runtime';
export function badResume(x: Result): any {
throw new Error('program is not paused. (Did you call .resume() twice... |
mwilliamson/Stopify | normalize-js/ts/callcc.ts | /**
* Adds support for callCC.
*
* This module is a Node plugin. In addition, it can be applied from the
* command line:
*
* node built/src/callcc/callcc <filename.js>
*/
const arrowFunctions = require('babel-plugin-transform-es2015-arrow-functions');
import * as desugarLoop from './desugarLoop';
import * as des... |
mwilliamson/Stopify | normalize-js/ts/jumperizeTry.ts | /**
* This transformation preprocesses try statements for jumper.
*
* - Finally [FILL]
*
* - In a catch clause, the name of the captured exception is not 'var'-bound in
* the enclosing function. i.e., the following program throws an exception:
*
* function F() {
* try {
* throw 'x';
* ... |
mwilliamson/Stopify | stopify-continuations-compiler/src/compiler/markAnnotated.ts | import { NodePath } from 'babel-traverse';
import * as t from 'babel-types';
import { isStopifyAnnotation, FlatnessMark } from '../helpers';
function markerVisitor(path: NodePath<FlatnessMark<t.CallExpression|t.NewExpression|t.FunctionDeclaration|t.FunctionExpression>>) {
const { leadingComments } = path.node;
... |
mwilliamson/Stopify | stopify/test/semantics.test.ts | import * as fs from 'fs';
import * as stopify from '../src/entrypoints/compiler';
import * as assert from 'assert';
import * as fixtures from './testFixtures.js';
import * as types from '../src/types';
// The compiler produces code that expects Stopify and its runtime compiler to
// be a global variable.
(global as an... |
mwilliamson/Stopify | stopify/test/testFixtures.ts | import * as fs from 'fs';
import * as path from 'path';
import * as tmp from 'tmp';
import * as glob from 'glob';
import { execSync } from 'child_process';
export {
unitTests,
intTests,
deepTests,
browserTest,
}
const unitTests = glob.sync('test/should-run/*.js', {})
const intTests = glob.sync('test/should-ru... |
wadii10/react-invoice-generator | src/data/types.ts | import { CSSProperties } from 'react'
export interface ProductLine {
ref: string,
description: string
quantity: string,
tva: string,
remise: string,
prix: string
}
export interface Invoice {
logo: string
logoWidth: number
title: string
companyName: 'Ellouze'
name: string
companyAddress: 'Tunis... |
wadii10/react-invoice-generator | src/data/initialData.ts | <filename>src/data/initialData.ts
import { ProductLine, Invoice } from './types'
export const initialProductLine: ProductLine = {
ref:'',
description: '',
quantity: '1',
prix: '0.00',
remise:'0',
tva:'0'
}
export const initialInvoice: Invoice = {
logo: '',
logoWidth: 100,
title: 'Facture',
company... |
wadii10/react-invoice-generator | src/data/countryList.ts | const countryList = [
{ value: 'Tunisie', text: 'Tunisie' }
]
export default countryList
|
FJALCode/typescript-course | notas/1-1-22Interfaz.ts | <gh_stars>1-10
(() => {
interface xMen {
nombre : string,
edad : number,
poder ?: string
}
const enviarMision = (xmen : xMen) =>{
console.log(`Enviando a ${xmen.nombre} a la misión`);
};
const regresarMision = (xmen : xMen) =>{
console.log(`Enviand... |
FJALCode/typescript-course | notas/1-1-21PromesasTipeado.ts | (() => {
const retirarDinero= (montoRetirar : number):Promise<number> =>{
let dineroActual = 1000;
return new Promise( (resolve, reject) => {
if(montoRetirar >= dineroActual){
reject('No hay suficiente fondos');
}else{
dineroActual -= montoReti... |
FJALCode/typescript-course | notas/1-1-15tipos.ts |
// Tipos de datos
(function () {
let mensaje: string = 'Hola';
let numero: number = 123
let booleano: boolean = true; // false
let hoy: Date = new Date();
let cualquiercosa: string | Number | Date | boolean;
cualquiercosa = mensaje;
cualquiercosa = numero;
cualquiercosa = boolean... |
FJALCode/typescript-course | notas/1-1-20Promesas.ts | <gh_stars>1-10
(() => {
console.log('Inicio');
const prom1 = new Promise((resolve, reject) =>{
setTimeout(()=>{
resolve('Se termino la promesa');
// reject('Se rejecto la promesa');
},1000);
});
prom1
.then(mensaje => console.log(mensaje))
.catch... |
FJALCode/typescript-course | notas/1-1-16templates-literales.ts | (function () {
const nombre = 'Fernando';
const apellido = 'Antúnez';
const edad = 28;
// const salida = nombre + ' ' + apellido + ' ( ' + edad + ' )';
const salida = `${nombre} ${apellido} ( ${edad} )`;
console.log(salida);
})(); |
FJALCode/typescript-course | notas/1-1-32examenPractico.ts | <gh_stars>1-10
(()=>{
// Uso de Let y Const
const nombre = '<NAME>';
const edad = 23;
let PERSONAJE = {
nombre: nombre,
edad: edad
};
// Cree una interfaz que sirva para validar el siguiente objeto
interface heroe {
nombre: string,
artesMarciales: string[]
};
const batman : he... |
FJALCode/typescript-course | notas/1-1-18Funciones-de-flecha.ts | (function () {
const miFuncion = function (a: string) {
return a;
}
const miFuncionF = (a: string) => a;
// console.log(miFuncion('Hola'));
// console.log(miFuncionF('Que Tal'));
const sumarN = function (a: number, b: number) {
return a + b;
}
const sumarF = (a: numb... |
FJALCode/typescript-course | notas/1-1-25clases.ts | <filename>notas/1-1-25clases.ts
(() => {
class AvengerDeInfinityWar {
constructor(
public nombre: string,
public equipo: string,
public nombreReal?: string,
public puedePelear?: boolean,
public peleasGanadas: number = 1){}
}
const ant... |
FJALCode/typescript-course | notas/1-1-17Parametros-opc-oblg-xdefec.ts | (function () {
function activar ( quien ?: string, ){
if (quien) {
console.log(`La casa de ${quien}.`);
} else {
console.log('La casa de Juan');
}
}
activar('Fernando');
})(); |
FJALCode/typescript-course | notas/1-1-19Desestructuracion-objetos.ts | (() => {
const aveanger = {
nombre: 'Steve',
clave: '<NAME>',
poder: 'Droga'
}
const extraer = ( {nombre, poder} : any) => {
// console.log('hola');
console.log(nombre);
console.log(poder);
}
// const { nombre, clave, poder } = aveange... |
mauro-balades/pythonVSCode | src/client/jupyter/jupyterIntegration.ts | <gh_stars>1-10
/* eslint-disable comma-dangle */
/* eslint-disable implicit-arrow-linebreak */
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { inject, injectable, named } from 'inversify';
import { dirname } from 'path';
import { CancellationToken, Disposable, ... |
mauro-balades/pythonVSCode | src/client/activation/activationManager.ts | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
import { inject, injectable, multiInject } from 'inversify';
import { TextDocument } from 'vscode';
import { IApplicationDiagnostics } from '../application/types';
import { IActiveResourceService, IDocumentMa... |
rbernalber/archimedes-js | packages/utils/src/datetime/date-object.ts | <reponame>rbernalber/archimedes-js
import { TimeUnit } from './time-unit'
export type DateObject = Partial<Record<TimeUnit, number>>
|
rbernalber/archimedes-js | packages/components/src/components/behavioural-components/focusable-item/focused-item-handler.ts | <reponame>rbernalber/archimedes-js
import { ItemPosition } from '../../../utils/position'
export interface FocusedItemHandler {
notifyFocusedItem(position: ItemPosition): void
}
|
rbernalber/archimedes-js | packages/utils/src/datetime/timestamp.ts | // HH:mm:ss:ms
export type Timestamp = string
|
rbernalber/archimedes-js | packages/utils/src/http-client/http-params.ts | export class HttpParams {
private constructor(private readonly param: URLSearchParams) {}
static create() {
return new HttpParams(new URLSearchParams())
}
set<Value extends string | boolean | number>(key: string, value: Value): HttpParams {
this.param.set(key, value.toString())
return new HttpPara... |
rbernalber/archimedes-js | packages/arch/src/runner/links/executor-link.ts | import { BaseLink } from './base-link'
import { Context } from '../context'
export class ExecutorLink extends BaseLink {
async next(context: Context): Promise<void> {
context.result = context.useCase.internalExecute(context.param)
this.nextLink.next(context)
}
}
|
rbernalber/archimedes-js | packages/arch/src/runner/links/cache-link.ts | <gh_stars>0
import { BaseLink } from './base-link'
import { Context } from '../context'
import { CacheManager } from '../../cache/cache-manager'
import { InvalidationPolicy } from '../../cache/invalidation-policy'
import { CacheKey } from '../../cache/cache-key'
import { CacheInvalidations } from '../cache-invalidation... |
rbernalber/archimedes-js | packages/arch/src/use-case/query.ts | import { UseCase } from './use-case'
export abstract class Query<Result = void, Param = void> extends UseCase<Result, Param> {
readonly = true
}
|
rbernalber/archimedes-js | packages/arch/src/use-case/command.ts | import { UseCase } from './use-case'
export abstract class Command<Param = void, Result = void> extends UseCase<Result, Param> {
readonly = false
}
|
rbernalber/archimedes-js | packages/arch/src/runner/cache-invalidations.spec.ts | import { CacheInvalidations } from './cache-invalidations'
describe('CacheInvalidations', () => {
it('should set invalidations', () => {
CacheInvalidations.set('foo', ['bar'])
const actual = CacheInvalidations.invalidations
expect(actual).toEqual(new Map([['foo', ['bar']]]))
})
})
|
rbernalber/archimedes-js | packages/arch/src/runner/links/empty-link.spec.ts | <gh_stars>10-100
import { EmptyLink } from './empty-link'
import { instance, mock } from 'ts-mockito'
import { Link } from './link'
describe('EmptyLink', () => {
it('should do nothing when setting link', () => {
const emptyLink = new EmptyLink()
const link = mock<Link>()
const actual = emptyLink.setNext... |
rbernalber/archimedes-js | packages/utils/src/maybe/maybe-empty-error.ts | import { ExtendedError } from '../extended-error/extended-error'
export class MaybeEmptyError extends ExtendedError {
constructor() {
super('Maybe is empty')
}
}
|
rbernalber/archimedes-js | packages/components/src/components/swiper/swiper.tsx | <reponame>rbernalber/archimedes-js<filename>packages/components/src/components/swiper/swiper.tsx
import { Component, Event, EventEmitter, h, State } from '@stencil/core'
import refresh from './refresh.svg'
@Component({
tag: 'arch-swiper',
styleUrl: 'swiper.css',
shadow: true
})
export class Swiper {
@Event()
... |
rbernalber/archimedes-js | packages/components/src/components/button/button.stories.tsx | export default {
title: 'Button'
}
export const Base = () => {
return `<arch-button theme="secondary">Custom Button</arch-button>`
}
|
rbernalber/archimedes-js | packages/components/src/utils/keycodes.ts | export enum KeyCodes {
BACKSPACE = 'Backspace',
TAB = 'Tab',
RETURN = 'Enter',
ESC = 'Escape',
SPACE = ' ',
PAGE_UP = 'PageUp',
PAGE_DOWN = 'PageDown',
END = 'End',
HOME = 'Home',
LEFT = 'ArrowLeft',
UP = 'ArrowUp',
RIGHT = 'ArrowRight',
DOWN = 'ArrowDown',
DELETE = 'Delete'
}
|
rbernalber/archimedes-js | examples/example-angular/src/app/bar-qry.ts | <gh_stars>10-100
import { BazQry } from './baz-qry'
import { Injectable } from '@angular/core'
import { EvictCache, Query } from '@archimedes/arch'
@EvictCache
@Injectable({
providedIn: 'root'
})
export class BarQry extends Query<number> {
constructor(private readonly bazQry: BazQry) {
super()
}
async int... |
rbernalber/archimedes-js | packages/utils/src/range/range.spec.ts | <gh_stars>10-100
import { range } from './range'
describe('range', () => {
it('should return an array until the given number', () => {
const result = range(5)
expect(result).toEqual([0, 1, 2, 3, 4])
})
it('should return an array starting from 0', () => {
const result = range(0, 5)
expect(result)... |
rbernalber/archimedes-js | packages/components/src/utils/theme.ts | <gh_stars>0
export type Theme = 'primary' | 'secondary'
|
rbernalber/archimedes-js | packages/utils/src/datetime/datetime.spec.ts | import { Datetime } from './datetime'
import { MockDatetime } from './mock-datetime'
import { Duration } from './duration'
describe('Datetime', () => {
beforeEach(() => {
MockDatetime.mock(Datetime.fromIsoString('2019-07-22T01:02:03Z'))
MockDatetime.mockTimezone('utc')
})
afterEach(() => {
MockDatet... |
rbernalber/archimedes-js | packages/components/src/components/behavioural-components/keyboard-navigable/keyboard-navigable.tsx | <filename>packages/components/src/components/behavioural-components/keyboard-navigable/keyboard-navigable.tsx<gh_stars>10-100
import { Component, h, Host, Event, EventEmitter, Listen } from '@stencil/core'
import { KeyCodes } from '../../../utils/keycodes'
export interface KeyboardNavigationAction {
key: string
sh... |
rbernalber/archimedes-js | examples/example-react/src/container.ts | <gh_stars>10-100
export { container } from 'tsyringe'
|
rbernalber/archimedes-js | packages/components/src/index.ts | <filename>packages/components/src/index.ts<gh_stars>10-100
export { Swiper } from './components/swiper/swiper'
export { KeyCodes } from './utils/keycodes'
export {
ItemPosition,
ItemPosition1D,
ItemPosition2D,
ItemPosition3D,
isPosition1D,
isPosition2D,
isPosition3D
} from './utils/position'
export { Fo... |
rbernalber/archimedes-js | packages/arch/src/cache/invalidate-cache.ts | <reponame>rbernalber/archimedes-js
import 'reflect-metadata'
import { Class } from '@archimedes/utils'
import { UseCase } from '../use-case/use-case'
import { CacheInvalidations } from '../runner/cache-invalidations'
export function InvalidateCache(clazz: Class): void {
const metadata: Class[] | undefined = Reflect.... |
rbernalber/archimedes-js | packages/utils/src/http-client/http-error.ts | import { ExtendedError } from '../extended-error/extended-error'
export class HttpError extends ExtendedError {
constructor({ name, message }: { name: string; message: string }) {
super(`HTTP Error ${name}: ${message}`)
}
}
|
rbernalber/archimedes-js | packages/utils/src/datetime/time-units.ts | <filename>packages/utils/src/datetime/time-units.ts<gh_stars>10-100
export type TimeUnits = 'years' | 'months' | 'days' | 'hours' | 'minutes' | 'seconds' | 'milliseconds'
|
rbernalber/archimedes-js | packages/utils/src/index.ts | export { Maybe } from './maybe/maybe'
export type { Subject } from './observer/subject'
export type { Observer } from './observer/observer'
export { Datetime } from './datetime/datetime'
export type { DatetimeOptions } from './datetime/datetime'
export { Duration } from './datetime/duration'
export type { Timestamp } f... |
rbernalber/archimedes-js | packages/arch/src/runner/links/link.ts | import { Context } from '../context'
export interface Link {
setNext(link: Link): Link
next(context: Context): Promise<void>
}
|
rbernalber/archimedes-js | packages/arch/src/runner/links/base-link.ts | <gh_stars>0
import { EmptyLink } from './empty-link'
import { Context } from '../context'
import { Link } from './link'
export abstract class BaseLink {
nextLink: Link = new EmptyLink()
setNext(link: Link): Link {
this.nextLink = link
return this
}
abstract next(context: Context): Promise<void>
}
|
rbernalber/archimedes-js | packages/arch/src/runner/links/notification-link.ts | <reponame>rbernalber/archimedes-js
import { BaseLink } from './base-link'
import { Context } from '../context'
import { NotificationCenter } from '../../notifications/notification-center'
export class NotificationLink extends BaseLink {
constructor(private readonly notificationCenter: NotificationCenter) {
super... |
rbernalber/archimedes-js | packages/components/src/components/behavioural-components/focusable-item/focusable-item.tsx | import { Component, h, Prop, Event, EventEmitter, Host, Listen } from '@stencil/core'
import { ItemPosition } from '../../../utils/position'
@Component({
tag: 'focusable-item',
styleUrl: 'focusable-item.css',
shadow: true
})
export class FocusableItem {
@Prop() isInTabSequence: boolean = false
@Prop() positi... |
rbernalber/archimedes-js | packages/arch/src/runner/chain-error.ts | import { ExtendedError } from '@archimedes/utils'
export class ChainError extends ExtendedError {
constructor() {
super('The chain of responsibility has not been created. Use createChain first and then run the use case again.')
}
}
|
rbernalber/archimedes-js | packages/utils/src/datetime/info-options.ts | import { NumberingSystem } from 'luxon'
export interface InfoOptions {
locale?: string
numberingSystem?: NumberingSystem
}
|
rbernalber/archimedes-js | packages/components/src/components/behavioural-components/focusable-item/focusable-item.e2e.ts | import { newE2EPage } from '@stencil/core/testing'
import { ItemPosition } from '../../../utils/position'
describe('focusable-item', () => {
it('should render out of tab sequence', async () => {
const page = await newE2EPage()
await page.setContent('<focusable-item></focusable-item>')
const element = aw... |
rbernalber/archimedes-js | packages/arch/src/use-case/use-case.ts | import { Runner } from '../runner/runner'
import { ExecutionOptions } from './execution-options'
type Fn<Result, Param> = (params: { result: Result; param: Param; executionOptions: ExecutionOptions }) => void
type Id = number
export abstract class UseCase<Result = void, Param = void> {
abstract readonly: boolean
... |
rbernalber/archimedes-js | packages/arch/src/cache/cache.ts | <filename>packages/arch/src/cache/cache.ts
import { CacheKey } from './cache-key'
type Milliseconds = number
export interface CacheResult<T = unknown> {
createdAt: Milliseconds
returns: T
}
export interface Cache<T = unknown> {
create(): Cache<T>
get(key: CacheKey): CacheResult<T> | undefined
set(key: Cach... |
rbernalber/archimedes-js | packages/arch/src/archimedes.ts | import { Link } from './runner/links/link'
import { Runner } from './runner/runner'
export class Archimedes {
static createChain(links: Link[]) {
Runner.createChain(links)
return this
}
}
|
rbernalber/archimedes-js | packages/components/src/components/behavioural-components/activable-item/activated-item-listener.e2e.ts | import { newE2EPage } from '@stencil/core/testing'
import { KeyCodes } from '../../../utils/keycodes'
describe('activated-item-listener', () => {
it('renders', async () => {
const page = await newE2EPage()
await page.setContent('<activated-item-listener></activated-item-listener>')
const element = await... |
rbernalber/archimedes-js | packages/arch/src/runner/runner.spec.ts | <filename>packages/arch/src/runner/runner.spec.ts<gh_stars>0
import { Runner } from './runner'
import { Link } from './links/link'
import { anything, instance, mock, verify } from 'ts-mockito'
import { UseCase } from '../use-case/use-case'
describe('Runner', () => {
it('should run the runner', async () => {
cons... |
rbernalber/archimedes-js | packages/arch/src/cache/invalidation-policy.ts | <reponame>rbernalber/archimedes-js
export enum InvalidationPolicy {
NO_CACHE,
ALL
}
|
rbernalber/archimedes-js | packages/arch/src/runner/links/null-link.ts | import { Context } from '../context'
import { ChainError } from '../chain-error'
import { BaseLink } from './base-link'
export class NullLink extends BaseLink {
async next(_context: Context) {
throw new ChainError()
}
}
|
rbernalber/archimedes-js | examples/example-angular/src/app/app.component.ts | import { Component, OnDestroy, OnInit } from '@angular/core'
import { BarQry } from './bar-qry'
import { FooCmd } from './foo-cmd'
import { BazQry } from './baz-qry'
import { QuxCmd } from './qux-cmd'
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
ex... |
rbernalber/archimedes-js | packages/utils/src/maybe/maybe.ts | <gh_stars>10-100
import { CallbackFunction } from './callback-function'
import { MaybeEmptyError } from './maybe-empty-error'
export class Maybe<T> {
private constructor(private value: T | null) {}
static none<T>(): Maybe<T> {
return new Maybe<T>(null)
}
static from<T>(value: T | undefined | null): Maybe... |
rbernalber/archimedes-js | examples/example-react/src/qux-cmd.ts | <filename>examples/example-react/src/qux-cmd.ts
import { injectable } from 'tsyringe'
import { Command, EvictCache } from '@archimedes/arch'
@EvictCache
@injectable()
export class QuxCmd extends Command<number> {
async internalExecute(value: number) {}
}
|
rbernalber/archimedes-js | packages/utils/src/maybe/callback-function.ts | <reponame>rbernalber/archimedes-js<filename>packages/utils/src/maybe/callback-function.ts
export type CallbackFunction<T = unknown> = (...params: unknown[]) => T
|
rbernalber/archimedes-js | packages/components/src/components/behavioural-components/keyboard-navigable/keyboard-navigation-listener.e2e.ts | import { newE2EPage } from '@stencil/core/testing'
import { KeyCodes } from '../../../utils/keycodes'
describe('keyboard-navigation-listener', () => {
it('should render', async () => {
const page = await newE2EPage()
await page.setContent('<keyboard-navigation-listener></keyboard-navigation-listener>')
... |
rbernalber/archimedes-js | packages/arch/src/cache/cache-options.ts | <filename>packages/arch/src/cache/cache-options.ts<gh_stars>0
import { Cache } from './cache'
export interface CacheOptions {
ttl: number
cache: Cache
}
|
rbernalber/archimedes-js | packages/utils/src/http-client/http-params.spec.ts | import { HttpParams } from './http-params'
describe('HttpParams', () => {
it('should add a value', () => {
const given = HttpParams.create().set('foo', 'bar').set('baz', 'qux')
const actual = given.toString()
expect(actual).toBe('foo=bar&baz=qux')
})
})
|
rbernalber/archimedes-js | packages/utils/src/is-promise/is-promise.ts | <reponame>rbernalber/archimedes-js<filename>packages/utils/src/is-promise/is-promise.ts
export function isPromise(object: Promise<unknown> | unknown): object is Promise<unknown> {
return typeof object !== 'undefined' && typeof (object as Promise<unknown>).then === 'function'
}
|
rbernalber/archimedes-js | packages/components/src/components/button/button.e2e.tsx | import { newE2EPage } from '@stencil/core/testing'
describe('Button', () => {
it('should add primary theme', async () => {
const page = await newE2EPage()
await page.setContent('<arch-button theme="secondary"></arch-button>')
await page.waitForChanges()
const button = await page.find('arch-button >>>... |
rbernalber/archimedes-js | examples/example-angular/src/app/app.module.ts | <reponame>rbernalber/archimedes-js<gh_stars>10-100
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { AppComponent } from './app.component'
import { FooCmd } from './foo-cmd'
import { BarQry } from './bar-qry'
import { CacheInvalidations } from '@archimedes/arch'... |
rbernalber/archimedes-js | packages/arch/src/runner/logger.ts | export interface Logger {
log<T>(message: T): void
}
|
rbernalber/archimedes-js | packages/utils/src/datetime/string-unit-length.ts | export type StringUnitLength = 'narrow' | 'short' | 'long'
|
rbernalber/archimedes-js | packages/components/src/components/toast/toast.tsx | <filename>packages/components/src/components/toast/toast.tsx
import { Component, h, Prop } from '@stencil/core'
@Component({
tag: 'arch-toast',
styleUrl: 'toast.css',
shadow: true
})
export class Toast {
@Prop()
type?: 'error' | 'info' | 'success'
render() {
return (
<div class={{ [this.type ?? ... |
rbernalber/archimedes-js | packages/components/src/components/toast/toast.stories.tsx | <gh_stars>10-100
export default {
title: 'Toast'
}
export const Base = () => {
return `<arch-toast>There has been an error</arch-toast>`
}
|
rbernalber/archimedes-js | examples/example-react/src/index.tsx | import 'reflect-metadata'
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'
import { CacheInvalidations, CacheLink, CacheManager, ExecutorLink, LoggerLink, Runner } from '@archimedes/arch'
import { FooCmd } from './foo-cmd'
import { BazQry } from './baz-qry'
import ... |
rbernalber/archimedes-js | packages/arch/src/use-case/execution-options.ts | <reponame>rbernalber/archimedes-js
export interface ExecutionOptions {
inlineError: boolean
}
|
rbernalber/archimedes-js | packages/arch/src/runner/links/null-link.spec.ts | <gh_stars>0
import { NullLink } from './null-link'
import { instance, mock } from 'ts-mockito'
import { Context } from '../context'
import { ChainError } from '../chain-error'
describe('NullLink', () => {
it('should throw chain error', async () => {
const nullLink = new NullLink()
const context = mock(Contex... |
rbernalber/archimedes-js | examples/example-angular/src/app/baz-qry.ts | <reponame>rbernalber/archimedes-js
import { Injectable } from '@angular/core'
import { EvictCache, Query } from '@archimedes/arch'
@EvictCache
@Injectable({
providedIn: 'root'
})
export class BazQry extends Query<number> {
async internalExecute(param: void): Promise<number> {
return 42
}
}
|
rbernalber/archimedes-js | packages/arch/src/notifications/notification-center.spec.ts | import { NotificationCenter } from './notification-center'
import { Subject } from '@archimedes/utils'
describe('NotificationCenter', () => {
it('should create a notification', () => {
jest.useFakeTimers()
const notificationCenter = new NotificationCenter()
notificationCenter.new({ message: 'foo' })
... |
rbernalber/archimedes-js | packages/arch/src/runner/links/cache-link.spec.ts | <reponame>rbernalber/archimedes-js<gh_stars>0
import { CacheLink } from './cache-link'
import { anything, instance, mock, verify, when } from 'ts-mockito'
import { CacheManager } from '../../cache/cache-manager'
import { Context } from '../context'
import { UseCase } from '../../use-case/use-case'
import { Link } from ... |
rbernalber/archimedes-js | packages/components/src/components/behavioural-components/keyboard-navigable/keyboard-navigable.e2e.ts | <gh_stars>10-100
import { newE2EPage } from '@stencil/core/testing'
import { KeyCodes } from '../../../utils/keycodes'
import { KeyboardNavigationAction } from './keyboard-navigable'
describe('keyboard-navigable', () => {
it('should renders', async () => {
const page = await newE2EPage()
await page.setConte... |
rbernalber/archimedes-js | packages/utils/src/observer/subject.ts | <filename>packages/utils/src/observer/subject.ts
import { Observer } from './observer'
export interface Subject {
observers: Observer[]
register(observer: Observer): void
unregister(observer: Observer): void
publish(): void
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.