Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gnome-shell gnome-shell
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,834
    • Issues 1,834
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 135
    • Merge requests 135
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOME
  • gnome-shellgnome-shell
  • Merge requests
  • !2302

ui: Refactor main to be class-based, add getMain() global utility

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Evan Welsh requested to merge ewlsh/gnome-shell:ewlsh/refactor-main-for-esm into main May 24, 2022
  • Overview 7
  • Commits 2
  • Pipelines 34
  • Changes 109

Context

When ESM (ECMAScript Modules) land, it will no longer be possible to treat imports.ui.main as an object where properties (exports) can be re-assigned. To handle this change, imports.ui.main is refactored into a GnomeShell class which is the instantiated as a singleton in shell.js. shell.js uses a proxy to allow for circular references, this emulates how ES module imports are "live" and can be updated.

ECMAScript Modules are entirely asynchronous so to ensure shell/GnomeShell can be conditionally accessed synchronously outside of the imports system (e.g. in looking glass, extension utilities, etc.), add global.getShell() to retrieve the "shell" object in these contexts.

Notes

This MR refactors all imports of imports.ui.main and usages of Main., each of these imports will already be refactored when ESM is landed.

Edited Jul 04, 2022 by Evan Welsh
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: ewlsh/refactor-main-for-esm