MCPcopy
hub / github.com/processing/p5.js / registerAddon

Method registerAddon

src/core/main.js:158–175  ·  view source on GitHub ↗
(addon)

Source from the content-addressed store, hash-verified

156
157 static _registeredAddons = new Set();
158 static registerAddon(addon) {
159 const lifecycles = {};
160
161 // Don't re-register an addon. This allows addons
162 // to register dependency addons without worrying about
163 // them getting double-added.
164 if (p5._registeredAddons.has(addon)) return;
165 p5._registeredAddons.add(addon);
166
167 addon(p5, p5.prototype, lifecycles);
168
169 const validLifecycles = Object.keys(p5.lifecycleHooks);
170 for(const name of validLifecycles){
171 if(typeof lifecycles[name] === 'function'){
172 p5.lifecycleHooks[name].push(lifecycles[name]);
173 }
174 }
175 }
176
177 static decorations = new Map();
178 static registerDecorator(pattern, decoration){

Callers 15

p5.RendererGL.jsFile · 0.80
p5.Framebuffer.jsFile · 0.80
p5.Shader.jsFile · 0.80
webgpu.jsFile · 0.80
app.node.jsFile · 0.80
app.jsFile · 0.80
index.jsFile · 0.80
index.jsFile · 0.80
main.jsFile · 0.80
index.jsFile · 0.80
param_validator.jsFile · 0.80

Calls 2

addMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected