Skip to content
Provides a service which other atom packages can use to reload on file change
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
.gitignore
README.md
package.json

README.md

autoreload-package-service

provides a service which other packages can use to reload on file change

autoreload-package-service

Only works in dev mode!

Usage

package.json

{
  ...
  "consumedServices": {
    "autoreload": {
      "versions": {
        "^0.0.1": "consumeAutoreload"
      }
    }
  }
  ...
}

your package:

  #in main module
  consumeAutoreload: (reloader) ->
    reloader(pkg:"nameOfYourPackage",files:["package.json"],folders:["lib/"])
    # pkg has to be the name of your package and is required
    # files are watched and your package reloaded on changes, defaults to ["package.json"]
    # folders are watched and your package reloaded on changes, defaults to ["lib/"]

Keep in mind, the service wont be loaded if your activate function throws an error. This is recommended:

  #in main module
  activate: ->
    realActivate = ->
      #do your stuff
    if atom.inDevMode()
      try
        realActivate()
      catch e
        console.log e
    else
      realActivate()
  #make sure your deactivate wont throw, even when realActivate wasn't successful
  deactivate: ->
    somestuff?.dispose()

License

Copyright (c) 2015 Paul Pflugradt Licensed under the MIT license.

You can’t perform that action at this time.