Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 

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.

About

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

Resources

Packages

No packages published