Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/define accessor #14

Merged
merged 6 commits into from
Aug 28, 2014
Merged

Feature/define accessor #14

merged 6 commits into from
Aug 28, 2014

Conversation

Exodia
Copy link
Contributor

@Exodia Exodia commented Aug 28, 2014

for ISSUE #9

@@ -240,6 +240,14 @@

var e2 = new EooClass2('prop1', 'prop2');
e2.test();

Class.defineAccessor(Sub.prototype, 'testProp');
Copy link
Member

Choose a reason for hiding this comment

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

这里我感觉不应该给prototype,直接给个类就行了?毕竟我们的语义是“给类添加一个访问器”

Copy link
Contributor Author

Choose a reason for hiding this comment

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

在业务中应该是:defineAccessor(exports, name),主要考虑到defineAccessor不局限于 function

Copy link
Member

Choose a reason for hiding this comment

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

懂了~


function simpleGetter(name) {
var body = 'return typeof this.' + MEMBERS + ' === \'object\' ? this.'
+ MEMBERS + '.' + name + ' : undefined;';
Copy link
Member

Choose a reason for hiding this comment

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

防着name是关键字,乖乖[""]吧……别的没啥了

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

otakustay added a commit that referenced this pull request Aug 28, 2014
@otakustay otakustay merged commit e32badd into develop Aug 28, 2014
@Exodia Exodia deleted the feature/defineAccessor branch September 11, 2014 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants