Closed amccloud closed 9 years ago
This is mostly due to backwards compatibility. We might deprecate the property accessor and have a get-function instead, but that would be in a major release. One thing you could do until then is to add a kind of "polyfill" to defineProperty, where you just set a noop to defineProperty
, making the code work but not being able to access instances.
You can see documentation of the instances
property here: http://omniscientjs.github.io/api/02-immstruct-api-reference/#properties
@mikaelbr I actually am using es5-sham for defineProperty but it looks like the issue is with it https://github.com/es-shims/es5-shim/issues/297
@amccloud Have you tried other polyfills? https://github.com/zloirock/core-js
I think this is a issue with the polyfill. But, as we have a breaking change the API for this will change. As of 2.0.0
you do:
var immstruct = require('immstruct');
var s = immstruct('key', { foo: 1 });
immstruct.instance('key');
// or
var i2 = new immstruct.Immstruct();
var s2 = i2.get('key', { foo: 1 });
i2.instance('key');
https://github.com/omniscientjs/immstruct/blob/master/index.js#L169-L173
Is exporting the
instances
property necessary or can we do it another way? I can't seem to find any documentation to supportrequire('immstruct').instances