Select the Dev Tools window and use Ctrl+ Shift + I (Windows) / Cmd + Option + I (Mac) again. That is, launch Chrome Dev Tools in a separate window ( do not dock with the web page). To export a snippet, launch Dev Tools of the Dev Tools. However, there is no easy way to export and save the snippets. This will help others in the team take advantage of the useful scripts. We can export and distribute the snippets (in the team). See the result below, in figure-3.įigure-5B: Alternative to run a snippet Export Snippets Running this script sets the auth token and user name context in the above sample application. Sometimes, it might redirect you back to home screen, defeating the purpose. location.reload() // do it if your sample needs it. remember, fetch doesn't reject the promise unless it's network error (off-topic). Snippet-1 - // Make a call to retrive auth token, with all the needed parameters fetch(' ), err => console.log(err)) // not much to error handling, feel free to play with it. However, real applications would have few more pages and hence it’s tedious to login and navigate to say, the eighth page to debug every time. My sample is simplistic with a single page. To avoid going through the login process every time, run the following script, which retrieves auth token, user name, and sets it in the session storage. Figure-2: A sample application without a login session
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |