Comments (9)
👍 on this. Early on I was doing some pseudo-type checking on getters using isGetter
, but decided to drop that approach because I didn't find it reliable enough.
from nuclear-js.
Sure I can implement this to be a true isGetter check.
I was hesitant to do it at first since its a potentially expensive operation that will happen recursively.
@colindresj if you are planning to add these checks to your code I would wrap them in a flag that removes them in production code
from nuclear-js.
I can open a PR if you like. I hesitated because I didn't know if changing isGetter
to be more complicated would be discouraged for perf reasons.
from nuclear-js.
Definitely @jordangarcia. I think this kind of approach is useful in dev, where you don't care about perf.
In the future, I actually think Nuclear should automatically turn this (and other dev-only helpers) off when in production, kind of like React does with PropTypes, et al. That means updating how Nuclear config is currently handled though, so definitely a different issue entirely, and for now devs should take care of this themselves.
from nuclear-js.
@colindresj yeah its something i've been thinking about
as to having a nuclear.js
or nuclear-debug.js
be the version with the __DEV__
flag on and also having invariant checks like isGetter.
I like the idea of keeping the dispatch logs in the code as something that can be configured when you instantiate a Reactor
. At optimizely we have a flag that turns debugging on in production which has been immensely helpful when debugging issues that have already made it to prod.
I want to think about this a bit more before we decide anything. I am currently leaning towards adding more invariant checks and then having the minified version remove them.
Also: the way npm's package.json main
works is to point at the unminified version of Nuclear. I'd like to be able to allow people to use npm but get a version of Nuclear without the invariants. Anyone have ideas?
from nuclear-js.
@jordangarcia I think React has one version for npm, but has a const (NODE_ENV === "production"
) that determines whether or not the tests run. They presume that if you care about perf, you'll run it through Webpack and Uglify, which will strip the unreachable blocks.
from nuclear-js.
In addition, React has a set of npm-specific grunt tasks for building the unminified main file with the conditional checks that @appsforartists mentioned, as well as a dist
folder which includes minified files for React, addons, etc. I really like the approach, because you can build the library agnostic of where it'll be hosted, then have specific tasks for publishing it to NPM, etc.
The directory that eventually hits NPM is here: https://github.com/facebook/react/tree/master/npm-react
And the tasks for generating the files that get put in the directory are here: https://github.com/facebook/react/blob/master/grunt/tasks/npm-react.js
There's a release task that eventually publishes React everywhere it needs to: https://github.com/facebook/react/blob/master/grunt/tasks/release.js
from nuclear-js.
I am a bit uncomfortable adding this stricter validation without having a good way to remove it, and that will require rethinking the __DEV__
approach.
Punting this to 1.1.x
from nuclear-js.
I think that makes sense. I'd like to have I strong isGetter method, but think a strong approach to dev builds is even more important.
On Thu, Jun 4, 2015 at 1:42 PM, Jordan Garcia [email protected]
wrote:
I am a bit uncomfortable adding this stricter validation without having a good way to remove it, and that will require rethinking the
__DEV__
approach.Punting this to
1.1.x
Reply to this email directly or view it on GitHub:
#59 (comment)
from nuclear-js.
Related Issues (20)
- Is it possible to use ReactMixin with ECMA6 class extension syntax? HOT 3
- Data Bindings as Props instead of State HOT 3
- [HELP]NuclearJS + Babel 6 as transpiler HOT 3
- Nuclear Module HOT 4
- [Question] How do dispatch one action within another action? HOT 2
- [Question] Data store dependency HOT 3
- Getter dependencies not being cached HOT 15
- ImmutableJS dependency HOT 7
- [HELP] NuclearJs reports "TypeError: Cannot read property 'dispatch' of undefined" HOT 5
- Logging fails on older Android browsers when called with `null` or `undefined` HOT 3
- Upgrade Immutable to the latest version HOT 2
- When using batch, do not receive error when calling dispatch inside of dispatch HOT 2
- reactor.dispatch throwing error 'VM31785:6061 Uncaught Error: `dispatch` cannot be called with an `undefined` action type.' HOT 1
- ES6 Support HOT 1
- Is this project still being maintained? HOT 3
- Disable Dispatch logs using debug packages HOT 3
- Observer not called HOT 2
- Active? HOT 2
- Github Project Template Files
- Online documentation is out of date vs source documentation
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 nuclear-js.