This repository has been archived by the owner. It is now read-only.

Improve package activation and deactivation lifecycle #28

merged 1 commit into from Nov 12, 2017


None yet
1 participant

50Wliu commented Nov 12, 2017

  • Start watching if initial packages have already activated
  • Stop watching on package deactivation


  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions

Description of the Change

This PR improves the overall package lifecycle and adds a new spec file to specifically test the main module.

  • Previously, dev-live-reload assumed that it would always be activated on initial package startup. However, if it was disabled and then re-enabled during an active Atom session, it wouldn't receive the onDidActivateInitialPackages event and therefore never start watching files. To solve this, a hasActivatedInitialPackages check has been added that when true instructs dev-live-reload to immediately start watching files.
  • When deactivating the package, only the disposables were disposed of. This did not include the actual Watchers. Therefore if the package was activated and then deactivated, all stylesheets would continue to be watched. To solve this, all UI watchers are now destroyed on deactivation.
  • A new spec file, dev-live-reload-spec.js, has been added that tests package activation and deactivation.

Alternate Designs



More robust package lifecycle.

Possible Drawbacks


Applicable Issues


Improve package activation and deactivation
* Start watching if initial packages have already activated
* Stop watching on package deactivation

@50Wliu 50Wliu merged commit 83257d5 into master Nov 12, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed

@50Wliu 50Wliu deleted the wl-package-lifecycle branch Nov 12, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.