Comments (12)
This seems like a useful feature. When reasoning about an application the developer can more easily keep track of unwanted side-effects. It might also be helpful to have an optional "strict" mode of sorts that prevents prop collision by throwing an error.
from stampit.
I'm not sure we want a strict mode, because it would prevent the very common defaults and overrides pattern.
from stampit.
Could be a per stamp setting maybe to provide a sort of constant prop? I'm only conceptually speaking here, just thought it would be worth considering.
from stampit.
Firstly, I believe all the new features should be introduced after we finalize the 2.0 branch (merge existing PR's, implement #41).
The proposed feature looks useful, although a rare developer would need it. Instead of implementing every feature in the world we could leave extensibility points. For example the three new upcoming functions addMethods
, addState
, and addEnclose
are the very good candidate to be the first point. See possible code sample:
var oldAddState = stampit._addState;
stampit._addState = function (fixed, states) {
console.log(_.difference(fixed.state, _.merge.apply(null, [].concat(states))));
return oldAddState(fixed, states);
};
I haven't thought about the extensibility of stampit much. There got to be better ways to do it.
from stampit.
I agree, RE: finalize the 2.0 branch.
I also agree about making Stampit extensible.
However, I also think that static analysis of stamps is essential to Stampit as a tool for building large applications, and a tool that could very easily tell you which stamps are likely to play nice with each other would be very useful, indeed. Integrating it into Stampit core so that you can easily interact with it in the console as you're building the application seems like a very valid use-case to me ...
And it would only take a few lines of code to do it.
from stampit.
Would you please provide a code sample on how you see the
easily tell you which stamps are likely to play nice with each other
?
from stampit.
Rough prototype of how it might work
function checkClashes(objOne, objTwo) {
var props = Object.keys(objTwo)
Object.keys(objOne).forEach(function(key) {
if (props.indexOf(key) !== -1) {
console.warn('Merge overrides props.')
}
})
}
Allows developer to keep track of overrides therefore identifying unwanted overrides.
from stampit.
Clearly we'll want to include more detail in the message (like the key in question). This could happen one time per stamp, after the stamp is applied.
from stampit.
What's stamp is applied
?
from stampit.
@koresar Each iteration of this loop.
from stampit.
So, coming back to this issue. It looks alike the #67
Still, I need high level code samples (not the implementation details). How a stampit user would like to use this feature?
from stampit.
Close in favor of #67
from stampit.
Related Issues (20)
- Performance degradation in node.js 8 HOT 12
- 'Use metadata in static functions' sample code throws an error HOT 1
- Suggestions on how to leverage stampit w/ Vue.js? HOT 6
- Need some guidance HOT 5
- β¨ Add .version to stampit object HOT 4
- Link to API docs is broken in Readme? HOT 3
- Compose using an instance? HOT 4
- [Bug] RangeError: 'Maximum call stack size exceeded' when use setters HOT 3
- [SOLVED] How to express stampit factories and instances in typescript HOT 4
- Implementing the Decorator Pattern HOT 5
- π Stamps vs Traits vs Mixins vs Has-a/Is-a composition vs Multiple inheritance (classes) feature-by-feature comparison HOT 3
- when i return something in init(), and then i can not call all methods HOT 10
- when i use getter and setter, i got this, is this a issue? HOT 21
- array in props persist across instances of stamp HOT 1
- Website is down HOT 3
- Provide ES6 Module build HOT 8
- Not so much an issue but a question. HOT 4
- Please helpοΌI would like update V2 to V4 HOT 1
- RFC: TypeScript version bump + Type enhancements HOT 4
- Can't seem to mock axios in a stamp HOT 3
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 stampit.