           example.buildFiles(files)
             .then =>
               console.log('compiling example files', files)
-              @compileCloud true, files.map, files.basePath
-
-  flashCloudFile: (event) ->
+              @emitter.emit "#{@packageName()}:compile-cloud", {thenFlash: true, files: files.map, rootPath: files.basePath}
+              #@compileCloud true, files.map, files.basePath
+
+  flashCloudFile: (event) -> @deviceRequired =>
     @flashCloud event.target.dataset.path
 
-  flashCloudExampleFile: (event) ->
+  flashCloudExampleFile: (event) -> @deviceRequired =>
     file = event.target.dataset.path
-    @flashCloudExample file
+    @emitter.emit "#{@packageName()}:flash-cloud-example", {file}
 
   # Show serial monitor panel
   showSerialMonitor: ->


    contextMenus = {
      '.tree-view.full-menu [is="tree-view-file"] [data-name$=".cpp"]':flashExampleMenuItem,
      '.tree-view.full-menu [is="tree-view-file"] [data-name$=".ino"]':flashExampleMenuItem
      '.tree-view.full-menu [is="tree-view-directory"]':flashExampleMenuItem
    }

    @contextMenus.add atom.contextMenu.add contextMenus

          @SettingsHelper.setLocal 'compile-status', {filename: filename}
          atom.commands.dispatch @workspaceElement, "#{@packageName()}:update-compile-status"
          if !!thenFlash
            # want to explicitly set the file to flash since we cannot assume it from the current project when compiling a library example
            @emitter.emit "#{@packageName()}:flash-cloud", {firmware: filename}
          else
            @downloadBinaryPromise = null
        , (e) =>
