Giter Club home page Giter Club logo

provi's People

Contributors

betula avatar

Stargazers

 avatar

Watchers

 avatar

provi's Issues

api proposal: add "service" method

The "service" method makes a Proxy.

// Old one

const GateService = () => {
  const line = createLine('message');

  return {
    line
  }
}

export const initGate = () => provide(GateService);
export const getGate = () => provide(GateService).line;

// But better

export const gateService = service(() => {
  const line = createLine('message');

  return {
    line
  }
})

export const initGate = gateService.init;
export const getGate = () => gateService.line; // autoinit if not exists here

// And we can use it directly

import { gateService } from './gate-service';

// ...

Next improvement: add automatic getters for all '$' dollar started properties.

const connectService = service(() => {
  $hasError = box(false);
  // ...
  return {
    $hasError
  }
});


console.assert(connectService.hasError === false) // its will be greatly helpfull

It should be not a proxy -> it should be added real getters.
hmmm, think about more. ...I see performance problems with proxy

Proposal: Add "unsub" function

const AppService {}

const app = provide(AppService);

const unsubs = unsub(AppService);
collect(unsubs, () => {
  // ...
});

bug: warning pattern ["unsubscriber@>=2.2.0 && <3.0.0"]

warning Pattern ["unsubscriber@>=2.2.0 && <3.0.0"] is trying to unpack in the same destination "/Users/betula/Library/Caches/Yarn/v6/npm-unsubscriber-2.2.0-cdc8fe9351987d38f68afbc7363eede0c797d1ff-integrity/node_modules/unsubscriber" as pattern ["[email protected]"]. This could result in non-deterministic behavior, skipping.

about package module definition

{
	"name": "jsx-runtime",
	"amdName": "jsxRuntime",
	"version": "1.0.0",
	"private": true,
	"description": "Preact JSX runtime",
	"main": "dist/jsxRuntime.js",
	"module": "dist/jsxRuntime.module.js",
	"umd:main": "dist/jsxRuntime.umd.js",
	"source": "src/index.js",
	"types": "src/index.d.ts",
	"license": "MIT",
	"peerDependencies": {
		"preact": "^10.0.0"
	},
	"mangle": {
		"regex": "^_"
	},
	"exports": {
		".": {
			"types": "./src/index.d.ts",
			"browser": "./dist/jsxRuntime.module.js",
			"umd": "./dist/jsxRuntime.umd.js",
			"import": "./dist/jsxRuntime.mjs",
			"require": "./dist/jsxRuntime.js"
		}
	}
}

interface idea: from root return only "factory"

import { factory } from "spro"

import { provide } from "spro/client"
import { provide } from "spro/server"
import { factory } from "provi"

import { provide } from "provi/client"
import { provide } from "provi/server"

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.