Cocos Creator API

0.7.1

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

Window

Module: Editor

Window class for operating editor window

Properties

isMainWindow Boolean

If this is a main window

isFocused Boolean

If the window is focused

isMinimized Boolean

If the window is minimized

isLoaded Boolean

If the window is loaded

There are no properties that match your current filter settings. You can change your filter settings in the index section on this page. index

Methods

load
(
  • url
  • argv
)

load page by url, and send argv in query property of the url. The page level will parse the argv when the page is ready and save it in Editor.argv in page level

name type description
url string
argv object

show ( )

Show the window

close ( )

Close the window

focus ( )

Focus on the window

minimize ( )

Minimize the window

restore ( )

Restore the window

openDevTools
(
  • options
)

Open the dev-tools

name type description
options object
  • detach Boolean
    If open the dev-tools in a new window

adjust
(
  • x
  • y
  • w
  • h
)

Try to adjust the window to fit the position and size we give

name type description
x number
y number
w number
h number

commitWindowState
(
  • layoutInfo
)

Commit the current window state

name type description
layoutInfo object

restorePositionAndSize ( )

Restore window's position and size from the local profile layout.windows.json

sendToPage
(
  • channel
  • [arg ]
)

Send ipc messages to page

name type description
channel string
arg optional ...

whatever arguments the request needs

sendRequestToPage
(
  • request
  • [arg ]
  • reply
)
number

Send request to page and wait for the reply [Editor.Window.cancelRequestToPage]

name type description
request string

the request to send

arg optional ...

whatever arguments the request needs

reply function

the callback used to handle replied arguments

returns:

type: number

The session id can be used in Editor.Window.cancelRequestToPage

cancelRequestToPage
(
  • sessionId
)

Cancel request via sessionId

name type description
sessionId number

find
(
  • param
)
Editor.Window static

Find window by name or by BrowserWindow instance

name type description
param string | BrowserWindow

returns:

type: Editor.Window

addWindow
(
  • win
)
static

Add an editor window

name type description
win Editor.Window

removeWindow
(
  • win
)
static

Remove an editor window

name type description
win Editor.Window

commitWindowStates ( ) static

Commit all opened window states

saveWindowStates ( ) static

Save current windows' states to profile layout.windows.json at local

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index