diff --git a/lib/shared-method.js b/lib/shared-method.js index a3195e5c..1f8043e6 100644 --- a/lib/shared-method.js +++ b/lib/shared-method.js @@ -161,6 +161,12 @@ function SharedMethod(fn, name, sc, options) { } this.stringName = (sc ? sc.name : '') + (isStatic ? '.' : '.prototype.') + name; + + // Include any remaining metadata to support custom user-defined extensions + for (var key in options) { + if (this[key]) continue; + this[key] = options[key]; + } } function normalizeArgumentDescriptor(desc) { diff --git a/test/shared-class.test.js b/test/shared-class.test.js index e083cc5c..6c54a264 100644 --- a/test/shared-class.test.js +++ b/test/shared-class.test.js @@ -155,6 +155,16 @@ describe('SharedClass', function() { expect(sc.findMethodByName(METHOD_NAME).accessType).to.eql('READ'); }); + it('defines a remote method with arbitrary custom metadata', function() { + var sc = new SharedClass('SomeClass', SomeClass); + SomeClass.prototype.testFn = function() {}; + sc.defineMethod('testFn', { + isStatic: true, + accessScope: 'read:custom', + }); + expect(sc.findMethodByName('testFn').accessScope).to.eql('read:custom'); + }); + it('should allow a shared class to resolve dynamically defined functions', function(done) { var MyClass = function() {};