PP.create

Syntax

create(settings: Object);

Parameters

settings. Settings of the created object. This parameter must include the PPtype property that determines type of this object.

Description

The create method creates a PP object with specified settings.

Comments

The method returns a PP object.

Example

To execute the example, the HTML page must contain links to the PP.js scenario file and the PP.css styles file. Create a text area and show markup of DOM element that represents a div block in this area:

// Create a text area
var textArea = PP.create({
    PPType: PP.Ui.TextArea,
    ParentNode: document.body,
    Width: 200,
    Height: 50
});
// Create a DOM element that is a div block
var mark = PP.createElement(document.body, 'MarkClass', 'div');
// Display markup of this DOM element in the text area
textArea.setContent(PP.escapeHTML(mark.outerHTML));
/* Check if the created object is an instance of the class 
initialized by the PP.initClass method */
var isInitClass = PP.isPPInstance(textArea);
console.log("The textArea object " + (isInitClass ? "" : "is not ") + 
    "initialized by the instance of the class");

After executing the example a text area is created, and markup of DOM element (div block) is placed in this area:

The created text area object was checked if it is an instance of class initialized with the PP.initClass method. Checking result is shown to the browser console:

The textArea object is an initialized class instance

See also:

PP