Skip to content

Commit

Permalink
feat: export init function
Browse files Browse the repository at this point in the history
  • Loading branch information
zenozeng committed Oct 5, 2021
1 parent 3a4c84f commit 0bf68d8
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,24 @@ import Element from './element';
import Filters from './filters';
import constants from './constants';

(function(p5) {
function init(p5) {
/**
* @namespace p5
*/
RendererSVG(p5);
Rendering(p5);
IO(p5);
Element(p5);
Filters(p5);
RendererSVG(p5);
Rendering(p5);
IO(p5);
Element(p5);
Filters(p5);

// attach constants to p5 instance
Object.keys(constants).forEach(function(k) {
p5.prototype[k] = constants[k];
});
})(window.p5);
// attach constants to p5 instance
Object.keys(constants).forEach(function(k) {
p5.prototype[k] = constants[k];
});
}

if (typeof window.p5 !== "undefined") {
init(window.p5);
}

export default init;

0 comments on commit 0bf68d8

Please sign in to comment.