Comments (5)
Published and verified in prod it works! THANKSSSSS!
from ngrx-actions.
OMG you're right!!
I think that this is the only way to do it:
function Select(fn) {
return function(target: any, name: string): void {
const createSelect = function () {
// "this" is the final object reference
console.log('new creation - must be logged once', this);
return store.select(fn);
};
const selectorFnName = '__' + name + '__selector';
const getter = function () {
// "this" is the final object reference
return this[selectorFnName] || (this[selectorFnName] = createSelect.apply(this));
};
// Redefine property
if (target[selectorFnName]) {
throw new Error('You cannot use @Select decorator and a ' + selectorFnName + ' property.');
}
if (delete target[name]) {
console.log('define property');
Object.defineProperty(target, selectorFnName, {
writable: true,
enumerable: false,
configurable: true
});
Object.defineProperty(target, name, {
get: getter,
enumerable: true,
configurable: true
});
}
};
}
class Foo {
@Select()
bar;
}
var f = new Foo();
f.bar;
f.bar;
f.bar;
from ngrx-actions.
CLEVER! I'll make this change and see if it fixes the issues in prod env.
from ngrx-actions.
Uh ok... I was writing a pull reqest. No problem.. :)
from ngrx-actions.
what's ur email, i'd like to add u to my slack channel.
from ngrx-actions.
Related Issues (20)
- Action options HOT 1
- Store DI
- Example Stored + Entity HOT 3
- Return Store initial state to be used in the tests
- Can it be used with redux? HOT 1
- New @Effect decorator HOT 3
- @Action - samples in the README and articles are incorrect?
- NgrxActionsModule.forFeature - not working?
- @Dispatch
- Question: Unit testing with the @Select decorator
- RxJs 6 - Property 'pipe' does not exist in type 'Actions<Action>' HOT 1
- feat: support angular v6
- Question: any ETA for a ng6 compatible version? HOT 5
- Cannot find module 'ngrx-actions' HOT 8
- NgrxActionsModule nested reducers
- Publish 4.0.1 to NPM?
- Unexpected state mutation in reducers
- @Effect() decorator does not work HOT 1
- NGRX 7.x Upgrade HOT 2
- PLEASE DELETE. CREATED BY MISTAKE :D
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 ngrx-actions.