repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
amrtaher1234/Crypto-notifier-nest | src/shared/shared.module.ts | <filename>src/shared/shared.module.ts
import { CacheModule, Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { MailModule } from 'src/mail/mail.module';
import { Resource, ResourceSchema } from 'src/schemas/resource.schema';
import { User, UserSchema } from 'src/schemas/user.sch... |
amrtaher1234/Crypto-notifier-nest | src/user/user.service.ts | import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { Model } from 'mongoose';
import { User, UserDocument } from 'src/schemas/user.schema';
import { Quote } from 'yahoo-finance2/dist/esm/src/modules/quote';
import finance from 'yahoo-finance2';
import { CreateUserDto, Cr... |
amrtaher1234/Crypto-notifier-nest | src/tasks/tasks.service.ts | import { Injectable, Logger } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { Cron, CronExpression } from '@nestjs/schedule';
import { Model } from 'mongoose';
import { SendResourceMailDto } from 'src/mail/mail.dto';
import { MailService } from 'src/mail/mail.service';
import { User, Use... |
amrtaher1234/Crypto-notifier-nest | src/shared/finance/finance.service.ts | import { CACHE_MANAGER, Inject, Injectable } from '@nestjs/common';
import { Cache } from 'cache-manager';
import finance from 'yahoo-finance2';
import { Quote } from 'yahoo-finance2/dist/esm/src/modules/quote';
@Injectable()
export class FinanceService {
constructor(@Inject(CACHE_MANAGER) private cacheManager: Cache... |
amrtaher1234/Crypto-notifier-nest | src/app.module.ts | <reponame>amrtaher1234/Crypto-notifier-nest
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { MongooseModule } from '@nestjs/mongoose';
import { ScheduleModule } from '@nestjs/schedule';
import { UserModule } from './user/user.module';
import { SharedModule ... |
callmekungfu/seg3125-lab8 | src/data/catelog.ts | <gh_stars>0
export type RentalLocation = 'Toronto' | 'Ottawa' | 'Montreal' | 'Vancouver';
export interface RentalItem {
name: string;
preview_image_url?: string;
slug: string;
description: {
short: string;
full?: string;
};
price_per_day: number;
available_locations: RentalLocation[];
category:... |
callmekungfu/seg3125-lab8 | src/App.tsx | import React, { useState } from 'react';
import { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom';
import { Layout, Menu, Button, Tooltip } from 'antd';
import { QuestionOutlined } from '@ant-design/icons';
import './App.css';
import ShopComponent from './components/Shop';
import OrderComponent f... |
callmekungfu/seg3125-lab8 | src/components/Shop.tsx | import React, { useState } from 'react';
import { Menu, Card, Col, Row, Input } from 'antd';
import { VisionaryCatelog } from '../data/catelog';
const { SubMenu } = Menu;
const { Meta } = Card;
const { Search } = Input;
const ShopComponent = () => {
const [current, setCurrent] = useState('all');
return (
<div... |
callmekungfu/seg3125-lab8 | src/components/Order.tsx | <gh_stars>0
/* eslint-disable jsx-a11y/anchor-is-valid */
/* eslint-disable no-template-curly-in-string */
import React from 'react';
import {
Form,
Typography,
Input,
Row,
Col,
Button,
Select,
DatePicker,
Card,
List,
Skeleton,
Avatar,
} from 'antd';
import { VisionaryCatelog } from '../data/cat... |
callmekungfu/seg3125-lab8 | src/components/Chat.tsx | <reponame>callmekungfu/seg3125-lab8
import React from 'react';
import { Comment, Avatar, Typography, Input, Button } from 'antd';
const { TextArea } = Input;
const ChatComponent = () => {
return (
<div className="chat-container">
<Typography.Title level={2}>Live Support</Typography.Title>
<div class... |
ItzNesbroDev/ItzNesbro.js | index.ts | <filename>index.ts
export { ascii } from "./src/functions/ascii/ascii";
|
ItzNesbroDev/ItzNesbro.js | src/functions/ascii/ascii.ts | <filename>src/functions/ascii/ascii.ts
import figlet from "figlet";
interface IFiglet {
text: string;
channel: any;
}
/*
* @function ascii
* @param {IFiglet} figlet
* @returns {Promise<void>}
* @description This function will return a figlet ascii
* */
export const ascii = (props: IFiglet) => {
const { te... |
MoonG25/wangwang | src/cgv/entities/schedule.entity.ts | /**
* @todo 받아오는 데이터가 전부 string 이기때문에 변환처리 하기
*/
export class Schedule {
id: number;
theaterCode: number;
thearerName: string;
movieIdx: number;
movieCode: number;
playStartTime: string; // hhmm
playEndTime: string; // hhmm
} |
MoonG25/wangwang | src/cgv/dto/schedule-search.dto.ts | <gh_stars>0
import { IsString } from "class-validator";
import { RequestType, TheaterCode } from "../cgv.enum";
export class ScheduleSearchDto {
@IsString()
strId: string;
@IsString()
strMovieGroupCd: string;
@IsString()
strRequestType: RequestType;
@IsString()
strTheaterCd: TheaterCode;
} |
MoonG25/wangwang | src/cgv/cgv.constants.ts | export const CGV_URL = 'http://m.cgv.co.kr/WebAPP/Reservation/Common';
export const SEPARATOR = '(^오^)';
// redis keys
export const COMING_SOON = 'COMING_SOON'; |
MoonG25/wangwang | src/cgv/dto/theater-schedule.dto.ts | import { IsString } from "class-validator";
import { RankType, RequestType, TheaterCode } from "../cgv.enum";
export class TheaterScheduleDto {
@IsString()
strMovieGroupCd: string;
@IsString()
strMovieTypeCd: string;
@IsString()
strPlayYMD: string;
@IsString()
strRankType: RankType;
@IsString()
... |
MoonG25/wangwang | src/utils/index.ts | export const getPlayYMD = () => {
const today = new Date();
const year = today.getFullYear();
const month = today.getMonth();
const day = today.getDate();
return `${year}${addZero(month)}${addZero(day)}`;
};
export const addZero = (value: number) => {
return ('0' + value).slice(-2);
}; |
MoonG25/wangwang | src/cgv/cgv.service.ts | <reponame>MoonG25/wangwang<filename>src/cgv/cgv.service.ts
import { HttpService } from '@nestjs/axios';
import { Injectable, Logger } from '@nestjs/common';
import { Cron } from '@nestjs/schedule';
import { find, map } from 'rxjs';
import { CacheService } from 'src/cache/cache.service';
import { CGV_URL, COMING_SOON, S... |
MoonG25/wangwang | src/cgv/dto/search.dto.ts | <reponame>MoonG25/wangwang
import { IsDate, IsString } from "class-validator";
export class SearchDto {
@IsString()
name: string;
@IsDate()
screenDate: Date;
} |
MoonG25/wangwang | src/cgv/cgv.module.ts | <reponame>MoonG25/wangwang<filename>src/cgv/cgv.module.ts
import { HttpModule } from '@nestjs/axios';
import { Module } from '@nestjs/common';
import { CacheModule } from 'src/cache/cache.module';
import { CgvController } from './cgv.controller';
import { CgvService } from './cgv.service';
@Module({
imports: [HttpMo... |
MoonG25/wangwang | src/cgv/cgv.controller.ts | import { Body, Controller, Get, Post, Query } from '@nestjs/common';
import { CgvService } from './cgv.service';
import { ScheduleSearchDto } from './dto/schedule-search.dto';
import { SearchDto } from './dto/search.dto';
import { TheaterScheduleDto } from './dto/theater-schedule.dto';
@Controller('cgv')
export class ... |
MoonG25/wangwang | src/cgv/cgv.enum.ts | export enum RequestType {
THEATER = "THEATER",
}
export enum TheaterCode {
YONGSAN = "0013",
WANGSIMNI = "0074",
YEONGDEUNGPO = "0059",
CHEONHO = "0199",
HONGDAE = "0191",
}
export enum RankType {
MOVIE = "MOVIE",
} |
MoonG25/wangwang | src/cache/cache.module.ts | <gh_stars>0
import * as redisStore from 'cache-manager-redis-store';
import { CacheModule as BaseCacheModule, Module } from "@nestjs/common";
import { CacheService } from './cache.service';
// registerAsync가 필요한가?
@Module({
imports: [
BaseCacheModule.register({
store: redisStore,
host: 'localhost',
... |
ideadapt/SAFE | tests/ts_tests/viewporter.d.ts | <reponame>ideadapt/SAFE<gh_stars>0
// Type definitions for Zynga Viewporter v2.1
// Project: https://github.com/zynga/viewporter
// Definitions by: <NAME> https://github.com/borisyankov
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface Viewporter {
preventPageScroll: boolean;
forceDetect... |
ideadapt/SAFE | tests/ts_tests/linq.d.ts | <gh_stars>1-10
// Type definitions for linq.js 2.2
// Project: http://linqjs.codeplex.com/
// Definitions by: <NAME>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// todo: jQuery plugin, RxJS Binding
declare module linq {
interface EnumerableStatic {
Choice(...contents: any[]): Enumerabl... |
ideadapt/SAFE | tests/ts_tests/breeze-1.0.d.ts | // Type definitions for Breeze 1.0
// Project: http://www.breezejs.com/
// Definitions by: <NAME> <https://github.com/borisyankov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Updated Jan 14 2011 - <NAME> (www.ideablade.com)
declare module BreezeCore {
interface ErrorCallback {
(er... |
ideadapt/SAFE | tests/ts_tests/icheck.d.ts | <reponame>ideadapt/SAFE
// Type definitions for iCheck v0.8
// Project: http://damirfoy.com/iCheck/
// Definitions by: <NAME> https://github.com/qcz
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface ICheckOptions {
/**
* 'checkbox' or 'radio' to style only checkboxes or radio buttons, both by ... |
ideadapt/SAFE | tests/ts_tests/hammerjs.d.ts | <gh_stars>0
// Type definitions for Hammer.js 1.0.5
// Project: http://eightmedia.github.com/hammer.js/
// Definitions by: <NAME> <https://github.com/borisyankov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
// Gesture Options : https://github.com/Eigh... |
ideadapt/SAFE | tests/ts_tests/jquery.validation.d.ts | // Type definitions for jquery.validation 1.11.1
// Project: http://bassistance.de/jquery-plugins/jquery-plugin-validation/
// Definitions by: https://github.com/fdecampredon
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
interface ValidationOptions
{
de... |
ideadapt/SAFE | tests/ts_tests/cheerio.d.ts | <reponame>ideadapt/SAFE
// Type definitions for Cheerio
// Project: https://github.com/MatthewMueller/cheerio
// Definitions by: <NAME> <https://github.com/blittle>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface Cheerio {
addClass(classNames: string): Cheerio;
hasClass(className... |
ideadapt/SAFE | tests/ts_tests/casperjs.d.ts | // Type definitions for CasperJS v1.0.0 API
// Project: http://casperjs.org/
// Definitions by: <NAME> <https://github.com/jedhunsaker>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../phantomjs/phantomjs.d.ts" />
interface CasperModule {
create(options: CasperOptions): Caspe... |
HenryJMin/DCRefresher | src/utils/user.ts | <reponame>HenryJMin/DCRefresher
import * as ip from './ip'
import { modules } from '../core/modules'
const USERTYPE = {
UNFIXED: 0,
HALFFIXED: 1,
FIXED: 2,
SUBMANAGER: 3,
MANAGER: 4
}
const getType = (icon: string) => {
if (icon == '' || icon === undefined) {
return USERTYPE.UNFIXED
}
if (
ic... |
alexgo-io/stacks.js | packages/network/src/index.ts | <gh_stars>1-10
import { TransactionVersion, ChainID, fetchPrivate } from '@stacks/common';
export const HIRO_MAINNET_DEFAULT = 'https://stacks-node-api.mainnet.stacks.co';
export const HIRO_TESTNET_DEFAULT = 'https://stacks-node-api.testnet.stacks.co';
export const HIRO_MOCKNET_DEFAULT = 'http://localhost:3999';
expo... |
alexgo-io/stacks.js | packages/profile/src/profile.ts | import { signProfileToken, extractProfile } from './profileTokens';
import { getPersonFromLegacyFormat } from './profileSchemas';
import {
getName,
getFamilyName,
getGivenName,
getAvatarUrl,
getDescription,
getVerifiedAccounts,
getAddress,
getBirthDate,
getConnections,
getOrganizations,
} from './p... |
anthonyamaro15/typescript-fundamentals | src/App.tsx | interface DataTypes<T> {
data: T;
}
interface GenericIdentityFn<Type> {
<Type>(arg: Type): Type;
}
// here we basically define the type of the function
let myIdentity: GenericIdentityFn<number> = defineType;
// we can now pass anything to it
function defineType<T>(arg: T): T {
return arg;
}
// you can also ... |
avbdev/siksha | client/src/utils/endpoints/PostEndPoints.ts | <filename>client/src/utils/endpoints/PostEndPoints.ts
export enum PostEndPoint {
x = "",
}
|
avbdev/siksha | client/src/utils/endpoints/PatchEndPoints.ts | <filename>client/src/utils/endpoints/PatchEndPoints.ts
export enum PatchEndPoint {}
|
avbdev/siksha | client/src/components/atoms/Table/index.tsx | <gh_stars>0
import React, { useEffect, useMemo, useState } from "react";
import { apps } from "../../../mock/mock";
export interface IApps {
AppName: string;
AppId: string;
Owner: string;
UsersCount: number;
__Id?: any;
}
interface ITableHeader {
displayName: string;
ariaLabel: string;
}
interface Cust... |
avbdev/siksha | client/src/components/atoms/Table/TableBody.tsx | import React from "react";
import { isPrimitive, ObjectValues } from "./Utils";
export interface IRenderBodyProps {
// headerProps?: any;
// headerContainerProps?: any;
items?: any[];
}
export const RenderBody: React.FC<IRenderBodyProps> = (props) => {
const { items } = props;
return (
<tbody>
... |
avbdev/siksha | client/src/components/atoms/Table/TableHeaders.tsx | import React from "react";
import { isPrimitive } from "./Utils";
export interface IRenderHeaderProps {
headerProps?: any;
headerContainerProps?: any;
headers?: any[];
}
export const RenderHeaders: React.FC<IRenderHeaderProps> = (props) => {
const { headerProps, headerContainerProps, headers } = props;
ret... |
avbdev/siksha | client/src/utils/endpoints/DeleteEndPoints.ts | <gh_stars>0
export enum DeleteEndPoint {}
|
avbdev/siksha | client/src/components/atoms/Table/Table.tsx | <filename>client/src/components/atoms/Table/Table.tsx<gh_stars>0
import React from "react";
import "./Table.css";
import { IRenderBodyProps, RenderBody } from "./TableBody";
import { IRenderHeaderProps, RenderHeaders } from "./TableHeaders";
interface ITableProps extends IRenderBodyProps, IRenderHeaderProps {}
export... |
avbdev/siksha | client/src/mock/mock.ts | import { IApps } from "../components/atoms/Table";
export const apps: IApps[] = [
{
__Id: 1,
AppName: "Span",
AppId: "a0cd0b56-7a8a-44e6-960a-59473b39aed8",
Owner: "ostemson0",
UsersCount: 15,
},
{
__Id: 2,
AppName: "Solarbreeze",
AppId: "72e193ab-42da-4191-a965-db2056f4c468",
... |
avbdev/siksha | client/src/utils/endpoints/index.ts | <reponame>avbdev/siksha
import axios from "axios";
import { DeleteEndPoint } from "./DeleteEndPoints";
import { GetEndPoints } from "./GetEndPoints";
import { PatchEndPoint } from "./PatchEndPoints";
import { PostEndPoint } from "./PostEndPoints";
export const getData = (endpoint: GetEndPoints) => {
return axios
... |
avbdev/siksha | client/src/components/atoms/Table/Utils.ts | export type PrimitiveType = string | number | boolean | Symbol;
export function ObjectValues<T extends {}>(obj: T) {
return Object.keys(obj).map((objKey) => obj[objKey as keyof T]);
}
export function isPrimitive(value: any): value is PrimitiveType {
return (
typeof value == "string" ||
typeof value == "nu... |
avbdev/siksha | client/src/components/pages/App/App.tsx | <filename>client/src/components/pages/App/App.tsx
import React, { useEffect, useState } from "react";
import { apps } from "../../../mock/mock";
import { getData } from "../../../utils/endpoints";
import { GetEndPoints } from "../../../utils/endpoints/GetEndPoints";
import { Table } from "../../atoms/Table/Table";
impo... |
avbdev/siksha | client/src/utils/endpoints/GetEndPoints.ts | export enum GetEndPoints {
Users = "https://randomuser.me/api/?results=20",
}
|
avbdev/siksha | client/src/components/atoms/Toggle/Toggle.tsx | <filename>client/src/components/atoms/Toggle/Toggle.tsx
import React from "react";
import cx from "classnames";
import "./Toggle.css";
interface IToggleProps {
rounded?: boolean;
isToggled?: boolean;
onToggle?: () => void;
}
export const Toggle: React.FC<IToggleProps> = (props) => {
const { rounded, isToggle... |
alecharl/clientes-app | src/app/app.component.ts | import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'Bienvenidos a clientes-app';
curso: string = 'Curso Spring 5 con Angular 7';
autor: string = '<NAME>';
}
|
shujer/tree-utils | src/index.ts | <reponame>shujer/tree-utils<filename>src/index.ts
export { buildTree } from "./buildTree";
export { flattenTree } from "./flattenTree"; |
shujer/tree-utils | src/buildTree.ts | <reponame>shujer/tree-utils
export const buildTree = <
ID extends string,
PID extends string,
T extends { [key in ID | PID]: string }
>(
items: T[],
idKey: ID,
parentKey: PID,
rootVal?: string,
sort?: (a: T, b: T) => -1 | 1 | 0
) => {
type Wrapper = Map<string, T[]>;
type TreeNode = T & { children?:... |
shujer/tree-utils | src/flattenTree.ts | <reponame>shujer/tree-utils<gh_stars>1-10
export type TreeNode<CID extends string, T> = T &
{ [key in CID]?: TreeNode<CID, T>[] };
export const flattenTree = <
CID extends string,
T extends { [key in CID]?: TreeNode<CID, T>[] }
>(
items: TreeNode<CID, T>[],
childrenKey: CID = "children" as CID
) => {
const ... |
Pandawan/yave | src/base/components/scale.ts | <gh_stars>1-10
import { Component } from '@trixt0r/ecs';
import { Vector } from '../../utils';
/**
* Scale Component to represent an entity's scale/size in world space.
*/
export class Scale extends Vector implements Component {
/**
* Scale on the x axis.
*/
public declare x: number;
/**
* Scale on th... |
Pandawan/yave | src/rendering/index.ts | export * from './components/camera';
export * from './components/spriteRendering';
export * from './components/textRendering';
export * from './systems/cameraRenderer';
export * from './systems/framerateCounter';
export * from './systems/pixiRenderer';
export * from './pixiRenderingEngine';
export * from './renderingEn... |
Pandawan/yave | src/index.ts | export * from './engine';
export * from './base';
export * from './ecs';
export * from './extras/tilemap';
export * from './rendering';
export * from './utils';
|
Pandawan/yave | src/lib/tilemapPatch.ts | <reponame>Pandawan/yave
// eslint-disable-next-line
declare namespace PIXI.tilemap {
interface CompositeRectTileLayer {
addResizeableFrame(
texture_: PIXI.Texture | string | number,
x: number,
y: number,
tileWidth?: number,
tileHeight?: number,
animX?: number,
animY?: num... |
Pandawan/yave | src/rendering/pixiRenderingEngine.spec.ts | <filename>src/rendering/pixiRenderingEngine.spec.ts
import { PixiRenderingEngine } from './pixiRenderingEngine';
import PIXI, { Viewport } from '../lib/pixi';
import { Vector } from '../utils';
describe('PixiRendering', () => {
beforeEach(() => {
document.body.innerHTML = '<div id="game"></div>';
PIXI.utils.... |
Pandawan/yave | src/base/components/position.ts | import { Component } from '@trixt0r/ecs';
import { Vector } from '../../utils';
/**
* Position Component to represent an entity's position in world space.
*/
export class Position extends Vector implements Component {
/**
* Position on the x axis.
*/
public declare x: number;
/**
* Position on the y a... |
Pandawan/yave | src/rendering/systems/pixiRenderer.ts | <filename>src/rendering/systems/pixiRenderer.ts<gh_stars>1-10
import { ComponentClass } from '@trixt0r/ecs';
import { YaveEntityRenderingSystem, YaveEntity } from '@/ecs';
import { SpriteRendering } from '../components/spriteRendering';
import { PixiRendering } from '../components/pixiRendering';
import { TextRendering... |
Pandawan/yave | src/ecs/entity.spec.ts | import { YaveEntity } from './entity';
const uuidRegex = /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
describe('YaveEntity', () => {
const entity = new YaveEntity();
it('should have a pre-set uuid', () => {
expect(typeof entity.id).toBe('string');
expect(entity.id).toMatch(... |
Pandawan/yave | src/utils/index.ts | /* Utils are not exported to package, they're mostly for internal purposes */
export * from './math';
export * from './vector';
|
Pandawan/yave | src/ecs/index.ts | <gh_stars>1-10
export * from './ecs';
export * from './entity';
export * from './entitySystem';
export * from './runOptions';
export * from './system';
// TODO: This is kind of dirty...
export * from '@trixt0r/ecs';
|
Pandawan/yave | src/ecs/system.ts | <filename>src/ecs/system.ts<gh_stars>1-10
import { System } from '@trixt0r/ecs';
import { RunOptions } from './runOptions';
import { YaveEngine } from '@/engine';
import { YaveECS } from './ecs';
/**
* Basic ECS System.
*/
export abstract class YaveSystem extends System {
/**
* The reference to the Yave engine.... |
Pandawan/yave | src/rendering/pixiRenderingEngine.ts | <filename>src/rendering/pixiRenderingEngine.ts
import PIXI, { Viewport } from '@/lib/pixi';
import { AbstractRendering } from './renderingEngine';
import { Vector } from '@/utils';
export class PixiRenderingEngine extends AbstractRendering<PIXI.Application> {
/**
* Resource Loader for PIXI
*/
public readonly... |
Pandawan/yave | src/engine.ts | import {
SignalDispatcher,
ISignal,
SimpleEventDispatcher,
ISimpleEvent,
} from 'strongly-typed-events';
import { YaveECS, RunOptions } from '@/ecs';
import { PixiRenderingEngine } from '@/rendering';
import { YaveInput, YaveInputOptions } from '@/input';
interface YaveEngineOptions {
/**
* How long (in m... |
Pandawan/yave | src/input/normalize-wheel.d.ts | declare module 'normalize-wheel' {
/**
* Get normalized values of the scrollwheel event to be consistent between browsers and input device.
* This code tries to resolve a single slow step on a wheel to 1. (This does not mean the result will be between -1 and 1, simply that a reasonably slow scroll will be appro... |
Pandawan/yave | src/rendering/components/textRendering.ts | <filename>src/rendering/components/textRendering.ts
import PIXI from '@/lib/pixi';
import { PixiRendering } from './pixiRendering';
// NOTE: This is named TextRendering because "Text" name conflicts with pixi.js' Text and might be too confusing
export class TextRendering extends PixiRendering {
/**
* The PIXI.Tex... |
Pandawan/yave | src/ecs/ecs.spec.ts | import { YaveEngine } from '@/engine';
import { YaveECS } from './ecs';
import { YaveRenderingSystem, YaveSystem } from './system';
import { System } from '@trixt0r/ecs';
// Create a mock implementation of YaveEngine so it doesn't actually do anything
jest.mock('../engine');
class TestUnknownSystem extends System {
... |
Pandawan/yave | src/base/components/position.spec.ts | <gh_stars>1-10
import { Position } from './position';
import { Vector } from '../../utils';
describe('Position Component', () => {
describe('constructor', () => {
it('should work with empty parameters', () => {
const pos = new Position();
expect(pos.x).toBe(0);
expect(pos.y).toBe(0);
expe... |
Pandawan/yave | src/utils/vector.spec.ts | import { Vector } from './vector';
describe('Vector', () => {
describe('constructor', () => {
it('should set default values when used with empty parameters', () => {
const v = new Vector();
expect(v.x).toBe(0);
expect(v.y).toBe(0);
expect(v.z).toBe(0);
});
it('should set x and y ... |
Pandawan/yave | src/ecs/entitySystem.spec.ts | <filename>src/ecs/entitySystem.spec.ts
import { YaveEngine } from '@/engine';
import { YaveECS } from './ecs';
import { YaveEntity } from './entity';
import { YaveEntitySystem, YaveEntityRenderingSystem } from './entitySystem';
import { Aspect, Component } from '@trixt0r/ecs';
import { RunOptions } from './runOptions';... |
Pandawan/yave | src/engine.spec.ts | <gh_stars>1-10
import { YaveEngine } from './index';
import { YaveECS } from './ecs';
import { AbstractRendering } from './rendering';
import PIXI from './lib/pixi';
describe('YaveEngine', () => {
let engine: YaveEngine;
beforeEach(() => {
document.body.innerHTML = '<div id="game"></div>';
engine = new Ya... |
Pandawan/yave | src/input/input.ts | import normalizeWheel from 'normalize-wheel';
import { Vector } from '@/utils';
interface KeyBindings {
/**
* Binding of keycode to an array of [ virtualKeyCodes ]
*/
[keyCode: string]: string[];
}
interface KeyStates {
/**
* State of given key (true for active)
*/
[virtualKeyCode: string]: {
... |
Pandawan/yave | src/rendering/renderingEngine.ts | <gh_stars>1-10
import { Vector } from '@/utils';
export abstract class AbstractRendering<T> {
public renderingEngine: T | null = null;
/**
* HTML Element to render in.
*/
protected readonly container: HTMLElement;
/**
* Create a Rendering Engine.
* @param containerId The HTML #id of the container... |
Pandawan/yave | src/rendering/systems/pixiRenderer.spec.ts | <gh_stars>1-10
import { YaveEntity } from '@/ecs/entity';
import { PixiRenderer } from './pixiRenderer';
import PIXI from '@/lib/pixi';
import { Position, Rotation, Scale } from '@/base';
import { SpriteRendering } from '../components/spriteRendering';
import { TextRendering } from '../components/textRendering';
import... |
Pandawan/yave | src/base/components/scale.spec.ts | import { Scale } from './scale';
import { Vector } from '../../utils';
describe('Scale Component', () => {
describe('constructor', () => {
it('should work with empty parameters', () => {
const scale = new Scale();
expect(scale.x).toBe(1);
expect(scale.y).toBe(1);
expect(scale.z).toBe(1);
... |
Pandawan/yave | src/rendering/components/pixiRendering.ts | <reponame>Pandawan/yave
import { Component } from '@trixt0r/ecs';
import PIXI from '@/lib/pixi';
export abstract class PixiRendering implements Component {
/**
* The underlying PIXI object.
*/
public abstract get pixiObj(): PIXI.Container;
/**
* The transparency of the object (from 0 to 1);
*/
pub... |
Pandawan/yave | src/extras/tilemap/index.ts | export * from './components/staticTilemap';
export * from './components/tilemapRendering';
export * from './systems/tilemapProcessor';
|
Pandawan/yave | src/ecs/entitySystem.ts | import {
ComponentClass,
Component,
AspectListener,
Aspect,
Engine,
} from '@trixt0r/ecs';
import { YaveSystem } from './system';
import { RunOptions } from './runOptions';
import { YaveEntity } from './entity';
type CompClass = ComponentClass<Component>;
/**
* ECS System which processes each entity with o... |
Pandawan/yave | src/base/components/rotation.ts | <reponame>Pandawan/yave<gh_stars>1-10
import { Component } from '@trixt0r/ecs';
import { normalize, Vector } from '../../utils';
/**
* Rotation Component to represent an entity's rotation in world space.
*/
export class Rotation extends Vector implements Component {
/**
* Rotation on the x axis (in degrees).
... |
Pandawan/yave | src/extras/tilemap/components/dynamicTilemap.ts | /**
* TODO: Dynamic Tilemap (later when I have time)
*
* This is a tilemap similar to StaticTilemap, but instead of mapping position to TileDefinition,
* it maps position to entityId. Each tile is an entity but is rendered through the TilemapProcessor like with a StaticTilemap.
*
* The tileEntities have a "Tile" ... |
Pandawan/yave | src/ecs/ecs.ts | import { Engine, EngineMode, SystemMode, System } from '@trixt0r/ecs';
import { RunOptions } from './runOptions';
import { YaveEngine } from '@/engine';
import { YaveSystem } from './system';
export class YaveECS extends Engine {
/**
* Reference to the actual yave engine that uses this ECS engine.
*/
public ... |
Pandawan/yave | src/rendering/components/spriteRendering.ts | import PIXI from '@/lib/pixi';
import { PixiRendering } from './pixiRendering';
// NOTE: This is named SpriteRendering because "Sprite" name conflicts with pixi.js' Sprite and might be too confusing
export class SpriteRendering extends PixiRendering {
/**
* The PIXI.Sprite object.
*/
public sprite: PIXI.Spri... |
Pandawan/yave | src/ecs/runOptions.ts | <reponame>Pandawan/yave
/**
* The options to pass to the ECS's run method
*/
export interface RunOptions {
/**
* Change in time since last update/frame (in ms).
*/
deltaTime: number;
/**
* Whether or not this execution happens on a "render" or "update" tick
*/
isRendering: boolean;
}
|
Pandawan/yave | src/rendering/systems/cameraRenderer.spec.ts | <filename>src/rendering/systems/cameraRenderer.spec.ts
import { YaveEntity } from '@/ecs/entity';
import { Position, Rotation } from '@/base';
import { CameraRenderer } from './cameraRenderer';
import { Camera } from '../components/camera';
describe('CameraRenderer', () => {
let mockActiveCameraEntity: YaveEntity;
... |
Pandawan/yave | src/utils/math.spec.ts | import { normalize } from './math';
describe('Math Utils', () => {
describe('normalize', () => {
it("shouldn't change value between range", () => {
expect(normalize(5, 0, 10)).toBe(5);
});
it('should wrap a large value to start correctly', () => {
expect(normalize(12, 0, 10)).toBe(2);
})... |
Pandawan/yave | src/rendering/systems/framerateCounter.ts | <filename>src/rendering/systems/framerateCounter.ts
import { RunOptions, YaveRenderingSystem } from '@/ecs';
// TODO: Spec.ts
export class FramerateCounter extends YaveRenderingSystem {
private _textElement: HTMLElement;
constructor() {
super();
this._textElement = document.createElement('span');
this... |
Pandawan/yave | src/ecs/system.spec.ts | <filename>src/ecs/system.spec.ts
import { YaveSystem, YaveRenderingSystem } from './system';
describe('YaveSystem', () => {
class TestSystem extends YaveSystem {
process = jest.fn();
}
let system: TestSystem;
beforeEach(() => {
system = new TestSystem();
});
describe('initial', () => {
it('s... |
Pandawan/yave | src/utils/math.ts | <gh_stars>1-10
/**
* Normalizes any number to a given range
* by assuming the range wraps around when going below min or above max.
*
* NOTE: This is especially useful to wrap around angles (in rads or degs).
* @param value The value to normalize.
* @param start The start boundary.
* @param end The end boundary.... |
Pandawan/yave | src/extras/tilemap/components/staticTilemap.ts | <filename>src/extras/tilemap/components/staticTilemap.ts
import { Component } from '@trixt0r/ecs';
import { Vector } from '@/utils';
// TODO: Spec file
/**
* Creates a static tilemap where each tile is just an ID for a definition.
* This component keeps track of a definition of tiles.
* It represents the map as a ... |
Pandawan/yave | src/extras/tilemap/components/tilemapRendering.ts | <reponame>Pandawan/yave
import PIXI from '@/lib/pixi';
import { PixiRendering } from '@/rendering/components/pixiRendering';
import { Vector } from '@/utils';
type TileDefinition = PIXI.Texture | string;
export class TilemapRendering<TileId = string> extends PixiRendering {
/**
* Definition of each tile.
* Ke... |
Pandawan/yave | src/utils/vector.ts | <filename>src/utils/vector.ts<gh_stars>1-10
/**
* Represents a position, direction, rotation, etc. (can be used for 2D and 3D coordinates).,
*/
export class Vector {
public x: number;
public y: number;
public z: number;
/**
* Create a Vector with default values of 0
*/
constructor();
/**
* Creat... |
Pandawan/yave | src/base/components/rotation.spec.ts | <reponame>Pandawan/yave
import { Rotation } from './rotation';
import { Vector } from '../../utils';
describe('Rotation Component', () => {
describe('constructor', () => {
it('should set default values when used with empty parameters', () => {
const rot = new Rotation();
expect(rot.x).toBe(0);
... |
Pandawan/yave | src/base/index.ts | export * from './components/position';
export * from './components/rotation';
export * from './components/scale';
|
Pandawan/yave | src/extras/tilemap/systems/tilemapProcessor.ts | import { YaveEntity, YaveEntityRenderingSystem } from '@/ecs';
import { StaticTilemap } from '../components/staticTilemap';
import { TilemapRendering } from '../components/tilemapRendering';
import { Vector } from '@/utils';
/**
* Processes tilemaps to be rendered by the TilemapRendering engine.
* NOTE: This does no... |
Pandawan/yave | src/rendering/renderingEngine.spec.ts | import { AbstractRendering } from './renderingEngine';
describe('AbstractRendering', () => {
class MockRendering extends AbstractRendering<{}> {
init = jest.fn();
load = jest.fn();
render = jest.fn();
screenToWorldPosition = jest.fn();
worldToScreenPosition = jest.fn();
}
describe('construct... |
Pandawan/yave | src/ecs/entity.ts | <filename>src/ecs/entity.ts
import { AbstractEntity } from '@trixt0r/ecs';
import uuidv4 from 'uuid/v4';
/**
* Simple wrapper over Entity with pre-set UUID
*/
export class YaveEntity extends AbstractEntity {
constructor() {
super(uuidv4());
}
}
|
Pandawan/yave | src/lib/pixi.ts | <reponame>Pandawan/yave<gh_stars>1-10
// See: https://github.com/pixijs/pixi.js/issues/6227
import PIXI = require('pixi.js'); // TODO: Perhaps use @pixi/packages instead
window.PIXI = PIXI;
// Tilemap
import 'pixi-tilemap';
// Patch the tilemap with slightly modified functions for easier API usage
import './tilemapPat... |
Pandawan/yave | src/rendering/systems/cameraRenderer.ts | import { YaveEntityRenderingSystem, YaveEntity } from '@/ecs';
import { Position, Rotation } from '@/base';
import { Camera } from '../components/camera';
/**
* Rendering System for SpriteRendering and TextRendering component.
*/
export class CameraRenderer extends YaveEntityRenderingSystem {
constructor() {
s... |
Pandawan/yave | src/rendering/components/camera.ts | import { Component } from '@trixt0r/ecs';
export class Camera implements Component {
/**
* Whether or not this camera should affect the viewport.
*/
public active: boolean;
/**
* ID of the entity that the camera should be following.
* NOTE: The camera will retain its z position (zIndex).
*/
pub... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.