realm-js icon indicating copy to clipboard operation
realm-js copied to clipboard

Decorator support

Open jimthedev opened this issue 8 years ago • 3 comments

Hello,

I've written a library the provides basic babel decorator-legacy support to ES6 classes and was wondering if this is something best suited for userland or if you'd consider a PR?

https://npm.im/realm-util

Current syntax:

const ru = require('realm-util');
 
@realmSchema({
  properties: {
    name: { type: 'string' },
    age: { type: 'int' }
  }
})
class Artist {
  hello() {
    console.log('hi');
  }
}
 
console.log(Artist.schema);
/*
  {
    name: 'Artist',
    properties: {
      name: { type: 'string' },
      age: { type: 'int' }
    }
  }
 */

jimthedev avatar Feb 20 '17 16:02 jimthedev

Hi, thanks for reaching out @jimthedev. Someone will review what you've provided/shared and follow-up with some thoughts or questions. Cheers!

istx25 avatar Feb 20 '17 18:02 istx25

@istx25 Great. Thanks!

jimthedev avatar Feb 21 '17 15:02 jimthedev

@jimthedev this is great, thanks for reaching out! I think it's a bit premature for us to start relying on decorators because we need to support a multitude of environments, but maybe we'll look into it at some point in the future.

kristiandupont avatar Mar 08 '17 10:03 kristiandupont