| 8866 | */ |
| 8867 | xArg.FuncPtrAdapter = class FuncPtrAdapter extends AbstractArgAdapter { |
| 8868 | constructor(opt) { |
| 8869 | super(opt); |
| 8870 | if(xArg.FuncPtrAdapter.warnOnUse){ |
| 8871 | console.warn('xArg.FuncPtrAdapter is an internal-only API', |
| 8872 | 'and is not intended to be invoked from', |
| 8873 | 'client-level code. Invoked with:',opt); |
| 8874 | } |
| 8875 | this.name = opt.name || "unnamed"; |
| 8876 | this.signature = opt.signature; |
| 8877 | if(opt.contextKey instanceof Function){ |
| 8878 | this.contextKey = opt.contextKey; |
| 8879 | if(!opt.bindScope) opt.bindScope = 'context'; |
| 8880 | } |
| 8881 | this.bindScope = opt.bindScope |
| 8882 | || toss("FuncPtrAdapter options requires a bindScope (explicit or implied)."); |
| 8883 | if(FuncPtrAdapter.bindScopes.indexOf(opt.bindScope)<0){ |
| 8884 | toss("Invalid options.bindScope ("+opt.bindMod+") for FuncPtrAdapter. "+ |
| 8885 | "Expecting one of: ("+FuncPtrAdapter.bindScopes.join(', ')+')'); |
| 8886 | } |
| 8887 | this.isTransient = 'transient'===this.bindScope; |
| 8888 | this.isContext = 'context'===this.bindScope; |
| 8889 | this.isPermanent = 'permanent'===this.bindScope; |
| 8890 | this.singleton = ('singleton'===this.bindScope) ? [] : undefined; |
| 8891 | //console.warn("FuncPtrAdapter()",opt,this); |
| 8892 | this.callProxy = (opt.callProxy instanceof Function) |
| 8893 | ? opt.callProxy : undefined; |
| 8894 | } |
| 8895 | |
| 8896 | /** |
| 8897 | The static class members are defined outside of the class to |