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

Code review #1

Closed
hhzl opened this issue Jan 13, 2015 · 5 comments
Closed

Code review #1

hhzl opened this issue Jan 13, 2015 · 5 comments

Comments

@hhzl
Copy link
Owner

hhzl commented Jan 13, 2015

Please add notes, remarks about the code and the process.

@ghost
Copy link

ghost commented Jan 13, 2015

If snap.svg library is AMD-aware (so if has some header doing define call), it likely exports the Snap object. So it should not be accessed via global, like:

| s bigCircle smallCircle |

s := Snap value: 300 value: 600.

but via loader, like:

| s snapLib bigCircle smallCircle |

snapLib := require value: 'snap.svg'.
s := snapLib value: 300 value: 600.

@ghost
Copy link

ghost commented Jan 13, 2015

You can even load it dynamically completely, not putting it to deploy.js but actually loading it jit, like:

| s bigCircle smallCircle |

require value: #('snap.svg') value: [ :snapLib |
  s := snapLib value: 300 value: 600.

but the previous seems easier to read.

@hhzl
Copy link
Owner Author

hhzl commented Jan 13, 2015

@Herby

1

regarding the first comment: thank you, updated to use

| s snapLib bigCircle smallCircle |

snapLib := require value: 'snap.svg'.
s := snapLib value: 300 value: 600.

code

2

Regarding the second comment:

an argument in favor of adding it to deploy.js is that the library is included in the file the.js to be used for deployment.

@ghost
Copy link

ghost commented Jan 13, 2015

Hannes Hirzel wrote:

@Herby https://github.com/herby

1

regarding the first comment: thank you, updated to use

|| s snapLib bigCircle smallCircle |

snapLib := require value: 'snap.svg'.
s := snapLib value: 300 value: 600.
|

code
https://github.com/hhzl/Amber-snapsvg-demo/blob/master/src/AmberSnapsvg.st

2

Regarding the second comment:

an argument in favor of adding it to |deploy.js| is that the library
is included in the file |the.js| to be used for deployment.

Oh yes, I forgot. Definitely.

@hhzl
Copy link
Owner Author

hhzl commented Jan 17, 2015

Thank you

@hhzl hhzl closed this as completed Jan 17, 2015
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

No branches or pull requests

1 participant