title: VueJS Reactive Binding for a Plugin - How To?
body: <p>I am working on a Vue plugin for Pouch/CouchDB which will be open sourced, but as long as i can figure out an issue i am having:</p>
  
  <p>Currently i am trying to make the plugin closely to resemble Vuex, that has an internal state, and detect changes, and render the view when they happen.</p>
  
  <p>Inside the Vue instance i am initializing an object, and within that object i am trying to make two or three objects reactive, with defineReactive, until here its good.</p>
  
  <p>But when i try to change some values inside that object, the changes are not propagated to the View. BUT if i explicitly call <strong>this.$bucket._state.projects.__ob__.dep.notify()</strong>, the changes propagate.</p>
  
  <p>The current object representation of the Vue instance is like this: <code>Vue { $bucket: { _state: { projects: {} } } }</code></p>
  
  <p><code>$bucket._state</code> has been initialized with <code>defineReactive</code>. which i believe it should work, but i am not sure what's the exact problem in this case.</p>
  
  <p>Any idea?</p>
  
  <p>A partial of the code, the class in here is almost similar to <code>Vuex.Store({})</code></p>
  
  <pre><code>    constructor(schema = {}) {
  
      // Getting defineReactive from Vue
      const { defineReactive } = Vue.util;
  
      // Ignored Schema Keys
      const ignoredKeys = [
        'config',
        'plugins'
      ];
  
      // Internal Variables
      this._dbs = {};
  
      // Define Reactive Objects
      defineReactive(this, '_state', {});
      defineReactive(this, '_views', {});
  
      // Local Variables
      if (!schema.config) {
        throw new Error(`[Pouch Bucket]: Config is not declared in the upper level!`);
      }
  
      // Init PouchDB plugins
      if ((schema.plugins.constructor === Array) &amp;&amp; (schema.plugins.length &gt; 0)) {
        for (let i = 0; i &lt; schema.plugins.length; i++) {
          PouchDB.plugin(
            schema.plugins[i]
          );
        }
      }
  
      // Initializing DBs that are declared in the schema{}
      for (const dbname in schema) {
        if (schema.hasOwnProperty(dbname) &amp;&amp; ignoredKeys.indexOf(dbname) === -1) {
          this._initDB(
            dbname,
            Object.assign(
              schema.config,
              schema[dbname].config ? schema[dbname].config : {}
            )
          );
  
          this._initState(dbname);
        }
      }
    }
  </code></pre>