px Delegates

Delegates are customization points that permit a JavaScript (JS) program running in pxscene to make optional behavior of the pxscene core framework.

Currently the following delegate patterns are supported...

- Clearsceen

A given pxscene JS app can choose to "decline" the default clear screen (to BLACK) by implementing the delegate method below.

This can offer performance improvements where App will be painting an opaque background, making a "clear to Black" redundant.


    // Delegate for Clearscreen
    module.exports.wantsClearscreen = function()
    {
        return false;
    };

... if implemented and exposed to the pxscene framework (present in your source file) this will skip the "clear to Black".

For example ...

  
    px.import("px:scene.1.js").then( function ready(scene) 
    {  
        // Delegate for Clearscreen
        module.exports.wantsClearscreen = function()
        {
            return false;
        };

        // additional code for pxscene JS app
        ...
        ...

    }).catch( function importFailed(err){
      console.error("Import failed for myApp.js: " + err)
    });






This project is maintained by pxscene

Hosted on GitHub Pages — Theme by orderedlist