Skip to content
View surol's full-sized avatar
👽
👽
  • Tomsk
  • 14:58 (UTC +07:00)
  • LinkedIn in/lorus

Organizations

@wesib @proc7ts @hatsyjs @run-z @frontmeans @UCNot

Block or report surol

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
surol/README.md

surol's GitHub stats
wakatime

Take a look at my projects

Asynchronous TypeScript-friendly HTTP server
import { httpListener, Rendering } from '@hatsy/hatsy';
import { dispatchByPattern, Routing } from '@hatsy/router';
import { createServer } from 'http';

const server = createServer(httpListener(
  Routing
    .and(Rendering)
    .for(
      dispatchByPattern({
        on: '**',
        to({ renderJson }) {
          renderJson({ hello: 'world' });
        },
      }),
    ),
));

server.listen(3000);
Run that, then this
package.json scripts and deps runner
# First, run `clean` task.
# After that run `build`, `lint`, and `test` tasks simultaneously.
# Then publish the package.
npx run-z clean build,lint,test --then npm publish
(In development) Web components building blocks

An UI framework based on web components.

Features IoC container, loadable features, routing, CSS-in-TS, form validation and processing, etc.

Defines custom elements by decorating a component classes:

import { Attribute, Component, ComponentContext, Render } from '@wesib/wesib';

@Component('greet-text') // Custom element name
export class MyComponent {
  
  @Attribute() // Custom attribute
  name: string;

  constructor(private readonly _context: ComponentContext /* IoC context */) {
  }

  @Render() // Render when component state changes
  render() {
    this._context.contentRoot.innerText = `Hello, ${this.name}!`;
  }

}

No need to extend HTMLElement or any other class. Instead, Wesib creates a custom element accordingly to its definition built either programmatically or using component decorators.

See RealWorld application implemented with Wesib.

Functional event processor

Handle events in reactive style. Think RxJS specialized on events rather generalized for data streams processing.

import { EventEmitter, OnEvent, translateOn } from '@proc7ts/fun-events';
import { Supply } from '@proc7ts/supply';

// API supports arbitrary event receiver signatures
// An event is its receiver's parameters
function printMessage(sender: string, message: string): void { 
  console.info(`Message from ${sender}: ${message}`);
}

const messageEmitter = new EventEmitter<[user: { name: string, email: string }, message: string, urgent?: boolean]>();
const onUrgentMessage: OnEvent<[string, string]> = messageEmitter.on.do(
  translateOn(
    // Translate urgent messages only
    (send, { name, email }, message, urgent = false) => urgent && send(`${name} <${email}>`, message),
  ),
);

// Call the `OnEvent` function to start receiving events
const supply: Supply = onUrgentMessage(printMessage);

// Emit some events
messageEmitter.send({ name: 'Tester', email: 'tester@example.com' }, 'Hello', true);
// Prints: "Message from Tester <tester@example.com>: Hello"
messageEmitter.send({ name: 'Tester', email: 'tester@example.com' }, 'Not so urgent');
// Prints nothing

// Cutting off message supply
supply.off();

// Messages won't be received any more
messageEmitter.send({ name: 'Tester', email: 'tester@example.com' }, 'Too late', true);
// Prints nothing

Other Tools And Libraries

Pinned Loading

  1. run-z/run-z run-z/run-z Public

    Run that, then this. package.json scripts and deps runner

    TypeScript 56 4

  2. hatsyjs/hatsy hatsyjs/hatsy Public

    Asynchronous TypeScript-friendly HTTP server for Node.js

    TypeScript 3

  3. proc7ts/fun-events proc7ts/fun-events Public archive

    Functional event processor

    TypeScript 4

  4. UCNot/churi UCNot/churi Public

    Multi-format schema-based serializer, deserializer and validator. Charged URI syntax. URI Charge Notation

    TypeScript 1