Skip to content

Commit

Permalink
Teamwork#62 Unable to make the application run on startup for all users
Browse files Browse the repository at this point in the history
  • Loading branch information
anaszgh committed Dec 10, 2017
1 parent 0a17a62 commit 472ec70
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions src/AutoLaunchWindows.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ module.exports =
# :appName - {String}
# :appPath - {String}
# :isHiddenOnLaunch - {Boolean}
# :onlyMe - (Optional) {Boolean}
# Returns a Promise
enable: ({appName, appPath, isHiddenOnLaunch}) ->
enable: ({appName, appPath, isHiddenOnLaunch,onlyMe}) ->
if(!onlyMe)
regKey.hive = Winreg.HKLM
return new Promise (resolve, reject) ->
pathToAutoLaunchedApp = appPath
args = ''
Expand All @@ -38,8 +41,11 @@ module.exports =


# appName - {String}
# onlyMe - (Optional) {Boolean}
# Returns a Promise
disable: (appName) ->
disable: (appName,onlyMe) ->
if(!onlyMe)
regKey.hive = Winreg.HKLM
return new Promise (resolve, reject) ->
regKey.remove appName, (err) ->
if err?
Expand All @@ -52,8 +58,11 @@ module.exports =


# appName - {String}
# onlyMe - (Optional) {Boolean}
# Returns a Promise which resolves to a {Boolean}
isEnabled: (appName) ->
isEnabled: (appName,mac,onlyMe) ->
if(!onlyMe)
regKey.hive = Winreg.HKLM
return new Promise (resolve, reject) ->
regKey.get appName, (err, item) ->
return resolve false if err?
Expand Down
9 changes: 5 additions & 4 deletions src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ module.exports = class AutoLaunch
# to add Login Item
# :name - {String}
# :path - (Optional) {String}
constructor: ({name, isHidden, mac, path}) ->
constructor: ({name, isHidden, mac, path,onlyMe}) ->
throw new Error 'You must specify a name' unless name?

@opts =
appName: name
isHiddenOnLaunch: if isHidden? then isHidden else false
mac: mac ? {}
mac: mac ? {},
onlyMe:onlyMe?true

versions = process?.versions
if path?
Expand Down Expand Up @@ -48,11 +49,11 @@ module.exports = class AutoLaunch
enable: => @api.enable @opts


disable: => @api.disable @opts.appName, @opts.mac
disable: => @api.disable @opts.appName, @opts.mac,@opts.onlyMe


# Returns a Promise which resolves to a {Boolean}
isEnabled: => @api.isEnabled @opts.appName, @opts.mac
isEnabled: => @api.isEnabled @opts.appName, @opts.mac,@opts.onlyMe


### Private ###
Expand Down

0 comments on commit 472ec70

Please sign in to comment.