How to migrate from our old v0 framework to our v1
Overview
Section titled โOverviewโThe migration from the old framework version can be done following these steps:
Head to the starter repo for our WP projects and get the following files:
- Project.js
- Main.js
- index.js from the transition folder
- Manager.js
- assetManager.js
- loadExtraAssets.js
- extraAssets.js
The changes in these files include:
Project.js
Section titled โProject.jsโ- Change from libManager to our new Manager
- Allocate instances
- Use assetManager instead of importing everything
- Load animations for viewport and outside of viewport elements in the
finally()at the end of the file
Main.js
Section titled โMain.jsโ- If we had it, there is no need to make an animations handler anymore and we will pass all of that into our
index.jsin transitions file - We will need to add the handler name to our handler instantiations
index.js from transition
Section titled โindex.js from transitionโ- Use assetManager instead of importing everything
Manager.js, assetManager.js, loadExtraAssets.js and extraAssets.js
Section titled โManager.js, assetManager.js, loadExtraAssets.js and extraAssets.jsโManager.jsis the new and improved version of our libManager, contains all methods used throughout the applicationassetManager.jsis the new function we use to load libraries and preloaders into our ManagerloadExtraAssets.jsandextraAssets.jswork together to load every library we need into our Manager- We will need to introduce every library we use into our
extraAssets.js
- We will need to introduce every library we use into our
This should take care of everything related to the Manager and instantiation of libraries.
Next we need to get the files relating to our handlers:
- CoreHandler.js
- Example handler
We will copy these files and that would be the base configuration for our handlers.
After that we will need to go through all of our handlers and adapt them to our new structure:
- Add the configuration for the library in the
constructor()method events()now only needs you to do two things:- call
super.assignInstances()with all the instances you need incontentReplaced - call
super.destroyInstances()using the library name inwillReplaceContent
- call
deploy
Knowledge Check
Test your understanding of this section
Loading questions...