请参考附件demo
主要代码:
- function FactorialFunction() {
- this.name = "FACTORIAL";
- this.maxArgs = 2;
- this.minArgs = 1;
- }
- FactorialFunction.prototype = new GC.Spread.CalcEngine.Functions.Function();
- FactorialFunction.prototype.evaluate = function (arg) {
- if(arguments.length === 1) {
- return arguments[0];
- } else {
- return arguments[0] + arguments[1];
- }
- };
- FactorialFunction.prototype.description = function () {
- return {
- description: '这是一条描述',
- parameters: [{
- name: 'value1',
- repeatable: false,
- optional: false
- },{
- name: 'value2',
- repeatable: false,
- optional: true
- }]
- }
- }
- var factorial = new FactorialFunction();
复制代码
|
|