0.0.2 • Published 9 years ago

atom-package-reloader v0.0.2

Weekly downloads
8
License
-
Repository
github
Last release
9 years ago

atom-package-reloader

reloades your atom packages on file change

atom-package-reloader

Install

npm install --save-dev atom-package-reloader

Usage

returns a Function({pkg,folders}) if atom.inDevMode()

optionsTypeUsage
pkgstringname of your package
foldersarray(optional) names of folders to watch defaults to '"lib"'

returns a object with three functions

functionUsage
reload()manually reloads your package
watchOnce()renews folder watchers
dispose()manually dispose folder watchers

watchOnce will be called automatically. One file change reload() and dispose() will be called.

if not atom.inDevMode() null will be returned

Example

Will only work in dev mode!

# inside of your activation function
# delay is necessary to eliminate double execution
# try-catch is only necessary if you use it as a dev-dependecy
setTimeout (->
  reloaderSettings = pkg:"name-of-your-package",folders:["lib","styles"]
  try
    reloader ?= require("atom-package-reloader")(reloaderSettings)
  catch

  ),500

# inside of your deactivation function
reloader?.dispose()
reloader = null

Release History

  • v0.0.1: First release

License

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