What is the new Router Lifecycle in Angular5? - angular5

I am new in Angular2/4/5 and before some days ago I started my new project in Angular5 with TypeScript.
I have to track the cycle of routing in my component.
Is it possible to achieve it?
I really appreciate your valuable feedback. Thanks in advance.

Related

Spartacus 3.3 - Best approach to start customizing pages and components

I have good knowledge of Angular but I am new to Spartacus storefront.
At the moment I have read a lot of documentation and watched many video tutorials but I have not yet understood how to start customizing pages and components: the documentation is unclear and other resources found are often out of date.
How can I understand from the CMS which is the Home page? And what are the components that build it? How can I customize them?
Can anyone tell me what is the best approach to start customizing the header, footer and content based on the sketches I need to replicate? Where do I find a step by step guide that helps me do this?
Thanks in advance for your help.
P.S. Locally I have a default B2C multisite installation (Appareal and Electronics) with our backend as baseSite.
Try joining the Spartacus courses SAP is giving, it will give you a good start on how to work with the CMS. They are free and hold value for beginners.
Using the CmsService you can get the currentPage and based on the UID you can determine if you are on the homepage.
You can override components by creating Angular components and creating an override based on the class or flexType https://sap.github.io/spartacus-docs/customizing-cms-components/
If you are new to Angular I really recommend doing a deep-dive on this first otherwise Spartacus will be very confusing. Been there...

How to transfer data from express to Nuxt

I'm a bit of a noob to the 'backend' part of Nuxt. But I'm trying to learn. I've set up a bot that's linked with Twitch. Their server sends a post to my own environment whenever someone follows or subscribes to a channel. I catch and handle this post with Express and would like to show that event on my Nuxt frontend. Unfortunately, I've yet to figure out how to get that data from the express server middleware to Nuxt whenever it comes in from Twitch. I've tried to find examples on the web, but haven't come across anything that seems to do this... Or I'm just too much of a noob to identify them as solutions.
I figured I'd use something like a WebSocket (Socket.io) to do this, however when instantiating the Express post handler I don't have access to Nuxt. And if I try it after I hand Nuxt to Express with (app.use(nuxt.render)) the post no longer gets passed through.
I also tried to add a store or adding a property to the Nuxt object itself, but again, I'd need Nuxt and the latter wouldn't give me the automatic pushing of data I'm looking for (hence the WebSocket idea).
Currently, the project is set up with a server/index.js where express is handed Nuxt to run the bot. I also have a WebSocket being initialised there. For now, I also handle the post-call there since I thought I'd at least be 'close' to the elements I need (Nuxt / Express) but I just don't see the way forward.
Any tips in the right direction would be much appreciated. If I need to add code to this post I can, at this point though I'm not sure what would help give this question a good answer.
Thanks in advance.

React-admin | Easiest way to warn user of a newer available version

I have a react-admin app where we are making frequent changes.
Is there an existing plugin or a way to detect a new version of app and provide user with a toast to refresh the application so that they are working with latest version?
If not with react-admin, is anyone familiar with a way to do this easily with react?
I have found some manual way to do this in following places but I am asking here in case there is an existing package or a more elegant solution that I can leverage directly.
How to force update Single Page Application (SPA) pages?
https://medium.com/#kellyrmilligan/create-react-app-let-your-users-know-when-the-app-has-been-updated-with-a-notification-21335d85481c
Any help is appreciated even if its, nothing exist and I should just hand-roll.
Thanks for reading.
This is not the responsibility of React Admin to handle this kind of issue.
You can think of RA as a simple React component that helps you define an admin.
Hence, RA doesn't provide any helper to manage code update or something similar.
You have to implement this refresh system by hand, and your links are a good start for that.
With the serviceWorker you can do that :
https://github.com/marmelab/react-admin/blob/master/examples/tutorial/src/registerServiceWorker.js
But i don't know why in the demo the service worker is not used ?
https://github.com/marmelab/react-admin/tree/master/examples/demo/src

I'm using vue(-router) to develop a hybrid app, how can I save some data in history state, so I can restore them when I back to previous pages?

In Android apps, when you start a new activity, the original activity is still in there, with all its internal data, so when you come back, it is the same as before.
How can I simulate this behaviour in my vue.js hybrid app? Is there some existing solution?
PS. I'm aware of vuex, but I think if I want to all the internal states of the pages in the history stack, then I must implement a stack-like structure by vuex myself. Is there some existing library can do this for me?
Thanks.
Wrapping <router-view> in <keep-alive> would get you expected results.
Or some custom baked solution, similar vuex-router-sync library to keep your page state in sync with the router.

how to create a custom application in twitter?

I’m trying to register a custom application in twitter can any one give some suggestions how to register a custom application in twitter? As I am new to twitter I didn’t found any controls to create to register for creating a custom application. Anyone's help will be much appreciated.
Thank you,
Monish.
Have a look at MGTwitterEngine to get you started and then ask more specific questions.