Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bypath

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bypath

Build effector and react applications with ease

  • 0.7.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

bypath

Simple framework for React, TypeScript and effector applications.

Installation

npm install bypath

Usage

// index.ts
import { createBrowserApplication } from 'bypath';
import { createEvent } from 'effector';

import * as navigation from 'entities/navigation';
import { routes } from './pages';

const applicationLoaded = createEvent()

const app = createBrowserApplication({
  routes,
  ready: applicationLoaded,
  domain: navigation.navigationDomain
  // domain is optional
  // for debug/logging
});

// connect local route events

forward({
  from: navigation.historyPush,
  to: app.navigation.historyPush
})
forward({
  from: navigation.historyPushSearch,
  to: app.navigation.historyPushSearch
})
forward({
  from: navigation.historyReplace,
  to: app.navigation.historyReplace
})
// some-page/contract.ts
import { createHatch } from 'bypath';

import { navigationDomain } from 'entities/navigation';

export const hatch = createHatch(navigationDomain);
// domain is optional
// for debug/logging
// some-page/index.tsx
import { guard, createDomain } from 'effector';
import { withHatch } from 'bypath';

import { historyPush } from 'entities/navigation';
import { $isAuthenticated } from 'entities/session';

import { hatch } from './contract';

export const Page = withHatch(hatch, () => {
  //...
});

guard({
  source: hatch.enter,
  filter: $isAuthenticated.map((is) => !is),
  target: historyPush.prepend(() => '/login')
});

Keywords

FAQs

Package last updated on 17 Jun 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc