react-native-unistyles
Version:
Level up your React Native StyleSheet
29 lines (28 loc) • 1.12 kB
JavaScript
"use strict";
import { UnistylesListener } from './listener';
import { UnistylesRegistry } from './registry';
import { UnistylesRuntime } from './runtime';
import { UnistylesShadowRegistry } from './shadowRegistry';
import { UnistylesState } from './state';
import { isServer } from './utils';
class UnistylesServices {
services = {};
constructor() {
this.runtime = new UnistylesRuntime(this.services);
this.registry = new UnistylesRegistry(this.services);
this.shadowRegistry = new UnistylesShadowRegistry(this.services);
this.state = new UnistylesState(this.services);
this.listener = new UnistylesListener(this.services);
this.services.runtime = this.runtime;
this.services.registry = this.registry;
this.services.shadowRegistry = this.shadowRegistry;
this.services.state = this.state;
this.services.listener = this.listener;
}
}
if (isServer() && !globalThis.__unistyles__) {
// @ts-ignore
globalThis.__unistyles__ = new UnistylesServices();
}
export const services = isServer() ? globalThis.__unistyles__ : new UnistylesServices();
//# sourceMappingURL=services.js.map