X Tutup
Skip to content

feat: support decorator chaining and class creation in ES5#2534

Closed
mhevery wants to merge 1 commit intoangular:masterfrom
mhevery:es5
Closed

feat: support decorator chaining and class creation in ES5#2534
mhevery wants to merge 1 commit intoangular:masterfrom
mhevery:es5

Conversation

@mhevery
Copy link
Copy Markdown
Contributor

@mhevery mhevery commented Jun 13, 2015

This PR allows to write code in ES5 like so:

Component({
  selector: 'my-component'
}).
View({
  template: 'Hello {{name}}'
}).
Class({
  constructor: [Greeter, Query(Type), function(greeter, types) {
    this.name = 'world';
    this.greeter = greeter;
  }],
  greet: function() {
    this.greeter.greet(this.name);
  }
})

@mhevery
Copy link
Copy Markdown
Contributor Author

mhevery commented Jun 13, 2015

@mhevery mhevery force-pushed the es5 branch 2 times, most recently from bc31f45 to 23320b3 Compare June 13, 2015 07:21
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Webstorm must have gotten confused on rename. :-) reverted.

@mhevery
Copy link
Copy Markdown
Contributor Author

mhevery commented Jun 13, 2015

@vicb added support for parameter annotations. Could you have a look.

@mhevery mhevery force-pushed the es5 branch 2 times, most recently from f29439a to a90231c Compare June 13, 2015 18:07
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge with makeDecorator, ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@vicb
Copy link
Copy Markdown
Contributor

vicb commented Jun 14, 2015

The one thing I don't like is how chaining is hard-coded. It might be nicer for competition but it makes harder to add support for other annotations ie RouteConfig

@mhevery
Copy link
Copy Markdown
Contributor Author

mhevery commented Jun 14, 2015

Not sure I understand hard coded. Any annotations such as RouterConfig can supply additional function to add chaining code.

var RouteConfig = makeDecorator(RouteConfigAnnotation, (fn) {
  fn.Component = Component;
  fn.Custum = CustomFunctionRef;
});

@mhevery mhevery closed this in c3ae34f Jun 14, 2015
@vicb
Copy link
Copy Markdown
Contributor

vicb commented Jun 15, 2015

@mhevery I am not really familiar with this code but I was under the impression that Component({}).View({}).RouteConfig({}) would not be possible unless you modify View to add a RouteConfig property to the returned object - and may be add it also to the object returned by Component to enable Component({}).RouteConfig({}).View({}) but then you would have to add View to the object returned by RouteConfig, ...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you seem to support inheritance but there doesn't seem to be a way to call the parent constructor. is that intentional?

@mhevery mhevery deleted the es5 branch June 16, 2015 23:43
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

X Tutup