Skip to content

_isGlobal is false when it should be true #7781

Closed
@quinton-ashley

Description

@quinton-ashley

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

v1.11.5

Web browser and version

any

Operating system

any

Steps to reproduce this

_isGlobal should be set to true when loading a global instance of p5 but it's always false in "init" addon methods.

This seems to have always been an issue in v1, not just in v1.11.5.

p5.prototype.registerMethod('init', function () {
  console.log(this._isGlobal); // returns false incorrectly
});

p5.prototype.registerMethod('afterSetup', function () {
  console.log(this._isGlobal); // returns true
});

function preload() {
  console.log(_isGlobal); // returns true
}

function setup() {}

function draw() {}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions