Skip to content

How to migrate from our old v0 framework to our v1

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:

  1. Project.js
  2. Main.js
  3. index.js from the transition folder
  4. Manager.js
  5. assetManager.js
  6. loadExtraAssets.js
  7. extraAssets.js

The changes in these files include:

  • 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
  • If we had it, there is no need to make an animations handler anymore and we will pass all of that into our index.js in transitions file
  • We will need to add the handler name to our handler instantiations
  • 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.js is the new and improved version of our libManager, contains all methods used throughout the application
  • assetManager.js is the new function we use to load libraries and preloaders into our Manager
  • loadExtraAssets.js and extraAssets.js work together to load every library we need into our Manager
    • We will need to introduce every library we use into our extraAssets.js

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:

  1. CoreHandler.js
  2. 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 in contentReplaced
    • call super.destroyInstances() using the library name in willReplaceContent

deploy