You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Ship TypeScript declarations for the public Store and ModelCache APIs.
7
+
- Modernize package output to ESM (`dist/backbone.store.mjs`), CJS (`dist/backbone.store.cjs`), and UMD (`dist/backbone.store.js`) through an `exports` map.
8
+
- Add `"type": "module"` for native ESM source and tooling.
9
+
- Change raw CommonJS consumption to use the default export: `require('backbone.store').default`.
10
+
- Remove the old `dist/backbone.store.esm.js` filename; use `dist/backbone.store.mjs` or the package root import instead.
11
+
- Keep UMD assignment on `Backbone.Store` without adding a `window.Store` global.
12
+
- Upgrade the test/build stack for Node 24 and replace Babel/Rollup/nyc with native ESM, tsdown, ESLint flat config, and c8.
13
+
14
+
### Fixes
15
+
16
+
- Prevent id-key collisions for ids such as `"toString"` and `"__proto__"` by using null-prototype cache storage.
17
+
- Track pending no-id models so Store-owned listeners are cleaned up if the model is reset, removed, or destroyed before receiving an id.
18
+
- Detach Store-owned `destroy` listeners when `Store.remove(modelName)`, `Store.removeAll()`, `Store.reset(modelName)`, or `Store.resetAll()` clears cached instances.
19
+
- Avoid object-inspection conflicts when assertion/debug tools call `Store.inspect(depth, options)` while formatting Store references.
All APIs that take `modelName` throw the same error as `Store.getCache(modelName)` when the model name is not recognized.
132
+
Calling `StoredModel.extend(...)` still delegates to Backbone's inherited `extend`; the returned child constructor is not automatically registered with Store unless it is passed through `Store(childModel, modelName)`.
133
+
96
134
### Store Events
97
135
98
136
#### `add`
@@ -165,11 +203,15 @@ Instances will have four properties:
165
203
#### `get(attrs, options)`
166
204
If the instance by index is not cached it is instantiated, cached, and returned.
167
205
Otherwise it returns the cached instance and sets the `attrs` on the model.
168
-
The `options` passed to this method will pass through to the `new` or the `set`.
206
+
The `options` passed to this method will pass through only when a new model is instantiated.
207
+
Use `patch(id, attrs, options)` when cached updates need `set` options.
ModelCache-level primitives backing the Store APIs of the same names.
214
+
173
215
## Acknowledgments
174
216
175
217
Backbone.Store is heavily inspired by [Backbone.UniqueModel](https://github.com/disqus/backbone.uniquemodel) written by [Ben Vinegar](http://github.com/benvinegar)
0 commit comments