Comments (3)
Resetting prototype.constructor
is standard fare in classical JS inheritance schemes, so throwing an error for any base
function passed to compose
that happens to do so (e.g., third-party modules installed via Bower) could prove problematic. Since constructor functions of other base
s are ignored, it would be nice if these constructors were treated the same. In order to prevent these constructors from overriding factory.prototype.constructor
, they could be deliberately excluded from the internal copyProperties
method, or factory.prototype.constructor = factory
could placed after the call to copyProperties
within compose
, instead of within cloneFactory
.
from compose.
As far as I can tell, a base having a method called constructor isn't really a problem. If there's a method called constructor
on the base, the resulting factory will just create instances that also have a constructor
method. I'm not sure why somebody would have a method called constructor
but it doesn't seem like it would cause any more problems for compose than it would in the first place.
In the case that the constructor is actually on the base.prototype
it seems like @mwistrand 's suggestion would be sufficient to handle this. This would just require adding one or two lines to create
and extend
, as mixin
passes the object through create
if it's not a ComposeFactory
anyway.
from compose.
Agreed that we should exclude constructor
from copyProperties
.
from compose.
Related Issues (20)
- Asynchronous initialization support? HOT 3
- Typescript 2.1 Merge Types HOT 2
- Remove deprecated `mixins` HOT 1
- Consider splitting createStateful HOT 1
- TypeScript 2.2 Object and Intersection Types HOT 2
- Update README to better reflect current design and usage
- API Doc Review for compose
- Upgrade to typescript 2.3.2
- Changes to Evented interfaces
- Changes to Stateful interfaces HOT 7
- Integration of dojo/interfaces
- Custom toString() is skipped by the factory HOT 1
- Additional Diagnostics HOT 3
- Proposal: Remove `.extend()` and replace with `.override()` HOT 5
- Stateful should emit a `state:initialized`
- Stateful should emit an initialization event HOT 1
- Stateful should emit "error" on observation error HOT 1
- Once initialized event has been emitted, subsequent events do not need to async HOT 1
- Events should not emit on the next turn and `state:initialized` is no longer required HOT 1
- Event globbing with Evented HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compose.