-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
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 proxyReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels