Cocos Creator API

0.7.1

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

Module Editor.Package

Package module for manipulating packages

Properties

paths array

Return package search path list

Methods

load
(
  • path
  • [opts ]
  • cb
)

Load a package at path

name type description
path string

An absolute path point to a package folder

opts optional object

Options

  • build boolean
    Force rebuild the packages
cb function

Callback when finish loading

unload
(
  • path
  • cb
)

Unload a package at path

name type description
path string

An absolute path point to a package folder

cb function

Callback when finish unloading

reload
(
  • path
  • opts
  • cb
)

Reload a package at path

name type description
path string

An absolute path point to a package folder

opts object

Options

  • rebuild Boolean
    If rebuild the project
cb function

Callback when finish reloading

panelInfo
(
  • panelID
)
object

Find and get panel info via panelID, the panel info is the json object that defined in panels.{panel-name} in your package.json

name type description
panelID string

returns:

type: object

packageInfo
(
  • path
)
object

Find and get package info via path, the package info is the json object of your package.json file

name type description
path string

The path can be any files in this package

returns:

type: object

packagePath
(
  • packageName
)
string

Return the path of the package by name

name type description
packageName string

returns:

type: string

build
(
  • path
  • callback
)
string

Build package at path

name type description
path string
callback function

returns:

type: string

addPath
(
  • path
)

Add package search path

name type description
path string | array

removePath
(
  • path
)

Remove search path from package search path list

name type description
path string

resetPath ( )

Reset path

find
(
  • name
)
string

Find package by name in package search path list

name type description
name string

package name

returns:

type: string

package path