import { createEvents } from './events';
import { reactiveContext } from './reactiveContext';
export function reactive(initialValue, { listeners, } = {}) {
    let _value = initialValue;
    const events = createEvents(listeners);
    return {
        get value() {
            return _value;
        },
        set value(v) {
            _value = v;
            reactiveContext.batchUpdates(() => events.emit());
        },
        addListener: events.addListener,
    };
}
//# sourceMappingURL=reactive.js.map