addFunc() - shysolocup/aepl GitHub Wiki

addFunc() and addFunction() adds a new function

const Class = require('aepl');


new Class("Main", class {
    constructor() {
        this.data = [1, 2, 3];
    }
});


Main.addFunc("reverse", function() {
    return this.data.reverse();
});


let main = new Main();

console.log(main.reverse()); // [3, 2, 1]

Class.addFunc()

description: adds a new function calls:

  • addFunc()
  • addFunction()
  • setFunc()
  • setFunction()
  • newFunc()
  • newFunction()
  • addF()
  • setF()
  • newF()