$$ is not defined


#1

I’m attempting to add a select list and i’m using the first “Select List” example from the style guide like this:

class FileListView extends SelectListView
      initialize: (@listOfItems) ->
        super
        @addClass('overlay from-top')
        @setItems(@listOfItems)
      attach: ->
        atom.workspaceView.append(this)
        @focusFilterEditor()
      # Here you specify the view for an item
      viewForItem: (item) ->
        $$ ->
          @li =>
            @raw item
      confirmed: (item) ->
        console.log(item)
    view = new FileListView(['one','two','three'])
    view.attach()

and I’m getting this error in the console:

Uncaught ReferenceError: $$ is not defined 

I checked the docs for atom/space-pen and noticed that $$ is supposed to be some sort of global variable or something. What exactly is the $$ variable and what is going wrong when I’m attempting to use this example?

Thanks for your help!


#2

You need to require it first with {$$} = require 'atom' to be able to use it