Giter VIP home page Giter VIP logo

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: '[email protected]' }, 'Hello', true);
// Prints: "Message from Tester <[email protected]>: Hello"
messageEmitter.send({ name: 'Tester', email: '[email protected]' }, 'Not so urgent');
// Prints nothing

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

// Messages won't be received any more
messageEmitter.send({ name: 'Tester', email: '[email protected]' }, 'Too late', true);
// Prints nothing

Other Tools And Libraries

Ruslan Lopatin's Projects

surol icon surol

Ruslan Lopatin (developer profile)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.