npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ember-cli-multi-store-service

v0.1.2

Published

A service for managing multiple Ember Data stores in an Ember CLI app.

Downloads

7

Readme

Ember-cli-multi-store-service

This is a fairly simple Ember CLI addon for managing multiple Ember Data stores. Normally one store is all that an application needs, but sometimes life throws you curve balls.

Why would I need multiple stores?

  • Loading fixture data in an easy to swap out area
  • Managing the state of multiple isolated databases
  • Working with historical data snapshots
  • Crazy situations I've never thought of

Are there any rules I need to follow to use this?

Not too many, but I have a few recommendations based on experience using multiple stores:

  • Stop using the injected store.
    • Either pass down the store that you want to use explicitly as an attr, or inject this service (service:multi-store) and grab the store you need by name as needed.
  • Seriously, don't inject the store into anything else like adapters or serializers
    • At this point the store that you use will pass itself to adapters and serializers, build them in a stateless fashion that only use the correct store passed in.
    • Each store from this service has a name attribute to be used for directing requests as needed at call time.
  • Use this in moderation
    • I know I'm not selling this well, but it should really only be useful when you need total data isolation and/or expect to see multiple conflicting versions of the same objects (same id and type).

How does this play with the Ember Inspector?

Not too bad, at least as far as I've tested it. There is a switchInspectorStore() method on the service that will let you change which store you're viewing information on. You'll have to change views away from the data section to see the change as it's not dynamically watching for the store change. This also uses an undocumented and private API for the inspector. Don't be surprised if it stops working. Instead just open a new issue and I'll take a look at it

How about some usage documentation?

I'll do this with an example, another service that wraps this one to give a higher level history service.

import Ember from 'ember';

const HistoryManager = Ember.Service.extend({
    // The service is registered under 'service:multi-store'
    storeManager: Ember.inject.service('multi-store'),
    // The list of registered names are observable with 'storeNames'
    revisionIds: Ember.alias('storeManager.storeNames'),

    getRecordRevision(record, revision) {
        const storeManager = Ember.get(this, 'storeManager');
        // Find if a store is registered with 'isStoreRegistered'
        if (storeManager.isStoreRegistered(revision)) {
            storeManager.registerStore(revision);
        }

        // Get a registered store by name with 'getStore'
        const store = storeManager.getStore(revision);
        return store.findRecord(record.constructor.modelName, record.id);
    },

    dropOldRevisions() {
        const storeManager = Ember.get(this, 'storeManager');
        Ember.get(this, 'revisionIds').forEach((revisionId) => {
            // Unregister a store by name with 'unregisterStore'
            storeManager.unregisterStore(revisionId);
        });
    },

    inspectRevision(revisionId=null) {
        // Switch the Ember Inspector with 'switchInspectorStore'
        // Pass undefined or null to set it to the default store
        // This uses private APIs and will probably break sometimes
        // Use this sparingly and only for testing
        Ember.get(this, 'storeManager').switchInspectorStore(revisionId);
    }
});

export default HistoryManager;