Comments (17)
Progress update, just working on getting tests to pass, I've already got the build to complete with AoT
from angular-safeguard.
Will release with next version thanks for all the info
from angular-safeguard.
Any update on the fix?
from angular-safeguard.
Here is a similar issue with another angular 2 module.
It looks like this is an issue with angular2-locker, not supporting ngc.
The author of this module fixed it with this commit:
andrucz/ionic2-rating@19a8bb8
from angular-safeguard.
Potential fix in this stack overflow answer:
http://stackoverflow.com/a/39868123/1646019
from angular-safeguard.
This is proving to be more difficult than expected. I may have to release this with an update since it's not working when I try adding in AoTPlugin
from angular-safeguard.
Okay. No hurry.
from angular-safeguard.
Doing AoT requires a bit of a change. The new api can either be
locker.put(DRIVERS.SESSION, 'key', value)
or a different injectable for each type
sessionLocker.put('key', value)
cookieLocker.put('key', value)
I'm inclined to use the former as it allows for more dynamic code (plus fallbacks can be done automatically vs having to do a check such as sessionLocker.supported() ? sessionLocker.put() : memoryLocker.put()
and is easier to test. What are your opinions @tobiasmuecksch , @VuongN?
from angular-safeguard.
At first impression, I like sessionLocker.put('key', value)
for the neat syntax and decoupling because each driver can do different things so you'd end up with a less complicated locker.put
. I hear you about the testing bit though.
from angular-safeguard.
@MikaAK Well. In my opinion both approaches aren't very convenient. If I had to choose one, I'd take the first option.
But how about having some kind of wrapper?
Like:
let myLocker = locker.getLocker(DRIVERS.SESSION);
locker.put('key', value);
The getLocker method (the name isn't optimal, but I didn't come up with a better one) creates a wrapper which does locker.put(DRIVERS.SESSION, 'key', value)
when calling the put()
method.
from angular-safeguard.
Unfortunately there is no way to return a new instance of itself because that breaks AoT so a getLocker method would end with the locker being just a wrapper to get storages which then begs the question why not just use way 1 with a separate type for each. I'm still leaning towards way two however as it will mean less on the user side to handle non supported drivers especially since in the case of safari private session and localstorage are unavailable so it would error unless you started doing checks and falling back to memory driver each time. I've already finished implementing way 2 as it was the easiest to switch to so I will probably release that and then see if there's to much complaint. Alternatively way 2 also allows for more expansion as users can create your own driver types .
Also each driver does the exact same thing anyway and the methods would be the same globally. You can expire session and localstorage the way I have it set up the same way you expire cookies
from angular-safeguard.
@MikaAK Roger. I think this information should then be mentioned (with a short statement why) in the readme in order to prevent confusion.
from angular-safeguard.
Hi! Could you release fixed version on this week?
from angular-safeguard.
Any updates on this issue? We are looking for a way to handle local storage in Angular and came across your project. Unfortunately, our project is using AOT and haven't been able to integrate your library. Thanks!
from angular-safeguard.
I do have the work done but unfortunately the tests need to change to accommodate the new style. I can push up the code to master once I'm home so you can begin to use it. Unfortunately I've been very busy with work and another side project that I've had no time to fix the tests. But I'll give it a stab over the weekend if I finish my other tasks.
from angular-safeguard.
Hi @MikaAK, Thanks for this awesome library. Were you able to push your AoT changes. I made some local changes to get this working with AoT but when i run in Safari Private Mode, I get this weird error - EXCEPTION: Can't find variable: DEV .... Any thoughts on this?
from angular-safeguard.
@onerandomgig it is pushed! The error is due to not being built and having compiler variables in the code
from angular-safeguard.
Related Issues (20)
- Error encountered resolving symbol values statically. Function calls are not supported. HOT 11
- Name change to angular-safeguard HOT 2
- Support of new version angular and angular-cli HOT 2
- Rollup pluggin compatible HOT 3
- Version 2 ? HOT 1
- ERROR in LockerModule is not an NgModule HOT 29
- ERROR in LockerModule is not an NgModule (with angular-cli) HOT 1
- Always use SESSION Storage , Cant able to set LOCAL or COOKIE HOT 5
- Allow Angular4 HOT 5
- ERROR in Error encountered resolving symbol values statically. HOT 2
- Supplied parameters do not match any signature of call target. HOT 1
- Create `dist` directory in master branch HOT 1
- update to @angular/core:4.1.0
- Compatibility with angular-locker when using hybrid app HOT 2
- Support for Angular 5
- Adding support for IndexedDB and CacheStorage HOT 1
- Bug in getting FALSE value HOT 1
- Angular 9 production build errors for type without a generic type argument HOT 3
- Angular 16: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).
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 angular-safeguard.