re-js / provi Goto Github PK
View Code? Open in Web Editor NEWMinimalistic and cute Service Provider
License: MIT License
Minimalistic and cute Service Provider
License: MIT License
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
const AppService {}
const app = provide(AppService);
const unsubs = unsub(AppService);
collect(unsubs, () => {
// ...
});
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.
serpro
provi
prode
inje
{
"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"
}
}
}
export const canUseDOM = !!(
typeof window !== "undefined" &&
typeof window.document !== "undefined" &&
typeof window.document.createElement !== "undefined"
);
https://github.com/molefrog/wouter/blob/5533ed0e4e776f484bbf6bd95e8134fe1554ffe7/react-deps.js
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"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.