Socket
Socket
Sign inDemoInstall

@chialab/synapse

Package Overview
Dependencies
3
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @chialab/synapse

Application framework built on the top of DNA Web Components.


Version published
Weekly downloads
187
decreased by-18.34%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

4.0.1

Patch Changes

  • b739ae5: Preserve final base hash in resolved urls.

Readme

Source

Synapse logo

Synapse • Application framework built on the top of DNA Web Components.

NPM


Get the library

Install via NPM or Yarn:

npm i @chialab/synapse
yarn add @chialab/synapse

Create an application

import { customElement, html, render } from '@chialab/dna';
import { App } from '@chialab/synapse';

@customElement('demo-app')
class DemoApp extends App {
    routes = [
        {
            pattern: '/',
            render(req, res) {
                return (
                    <main>
                        <h1>Home</h1>
                    </main>
                );
            },
        },
        {
            handler(req, res) {
                res.data = new Error('not found');
            },
            render(req, res) {
                return (
                    <main>
                        <details>
                            <summary>${res.data.message}</summary>
                            <pre>${res.data.stack}</pre>
                        </details>
                    </main>
                );
            },
        },
    ];

    render() {
        return (
            <>
                <header>
                    <h1>Synapse 3.0</h1>
                </header>
                <nav>
                    <ul>
                        <li>
                            <a href={router.resolve('/')}>Home</a>
                        </li>
                    </ul>
                </nav>
                {super.render()}
            </>
        );
    }
}

const app = render(<DemoApp base="/" />, document.getElementById('app'));

app.start('/');

Development

Build status codecov

Build

Install the dependencies

yarn

and run the build script:

yarn build

This will generate the ESM and CJS bundles in the dist folder and declaration files in the types folder.


License

Synapse is released under the MIT license.

FAQs

Last updated on 05 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc