"use strict";

exports.__esModule = true;
exports.reactive = reactive;
var _events = require("./events");
var _reactiveContext = require("./reactiveContext");
function reactive(initialValue, {
  listeners
} = {}) {
  let _value = initialValue;
  const events = (0, _events.createEvents)(listeners);
  return {
    get value() {
      return _value;
    },
    set value(v) {
      _value = v;
      _reactiveContext.reactiveContext.batchUpdates(() => events.emit());
    },
    addListener: events.addListener
  };
}
//# sourceMappingURL=reactive.js.map