Noob question about multiple files in Atom packages


This is more of a general Node question. I’m trying to clean up one of my packages by splitting it into several files.

Here’s a minimal representation of what I’m trying to do:

First file:

IncludeFile = require './include' # TAKE NOTE OF THIS
{CompositeDisposable} = require 'atom'

module.exports = MinTest =
  subscriptions: null

  activate: (state) ->CompositeDisposable
    @subscriptions = new CompositeDisposable

    @subscriptions.add atom.commands.add 'atom-workspace', 'test:notify': => IncludeFile.sayHello()

  deactivate: ->

Second file:

module.exports =
    sayHello: ->
      atom.notification.addInfo( 'Hello world!', dismissable: true)

When running the command, it will produce an error Uncaught TypeError: Cannot read property 'addInfo' of undefined. I’ve looked at other packages, and none of them requires atom in included files to have access to methods. What am I missing here?


atom.notifications, not atom.notification ?


I think that was it :smile_cat:

Thank you!