Last Modified: 2023-06-15

Rest API

doGet/doPost are handled with server/harness.lua, that can access UI table

function M:init(path, params)
	projRoot = path
  self.selectors = params.selectors
  self.UI        = params.UI
  self.bookTable = params.bookTable
  self.pageTable = params.pageTable
  self.layerTable = params.layerTable

end

function M:dispatchEevnt(eventName, params)
    self.UI.scene.app:dispatchEvent {
      name = eventName, -- "editor.selector.selectApp",
      UI = self.UI,
      params = params
    }
  -- selectApp
  --   returns books
  --
end

Transition2.page

App/Transition2 is a normal page of Solar2D composer. It does not have a model of index.lua. We coulld load Transition2.page with composer.gotoScene but this way does not work with kwik model with compoennts/commands.

So let’s define I/F.

httpYac

### for composer.gotoScene
GET /Transition2/page

### selectLayer
GET /Transition2/page/character

###
POST /Transition2/page/character/transition2.to

If index.lua is not found, it is a noraml composer page, and the following I/F are used for doGet and doPost

page.lua

function scene:getLayer(layerName)

function scene:getFunc(funcName)