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

Add exports #860

Merged
merged 4 commits into from Jul 18, 2013
Merged

Add exports #860

merged 4 commits into from Jul 18, 2013

Conversation

elemoine
Copy link
Member

This PR adds a number of exports for ol.js.

Basically, I think we should export the getters of exported constructor options. For example, "origin" is an (exported) option of the (exported) ol.tilegrid.TileGrid constructor. So it feels right to export the getOrigin property of ol.tilegrid.TileGrid.prototype.

Also, even if ol.layer.Layer isn't directly used by application developers, I think we should export the ol.layer.Layer symbol. Application developers do manipulate layers. To me this is a sufficient reason for exporting the ol.layer.Layer symbol. For example, it will also application developers to do layer instanceof ol.layer.Layer.

I'm sure there are other places when the above principles should be applied. For now, I just wanted to run this by more people. If this PR is merged I'll do a more thorough review and open new PRs.

FYI, w/o the four commits this PR adds:

2013-07-12 10:34:47,556 build/ol.js: java -jar build/plovr-eba786b34df9.jar build buildcfg/ol.json
0 error(s), 0 warning(s), 95.30% typed
2013-07-12 10:35:09,134 build/ol.js: uncompressed: 247264 bytes
2013-07-12 10:35:09,153 build/ol.js:   compressed: 79232 bytes

And w/ the four commits:

2013-07-12 10:37:11,088 build/ol.js: java -jar build/plovr-eba786b34df9.jar build buildcfg/ol.json
0 error(s), 0 warning(s), 95.30% typed
2013-07-12 10:37:32,538 build/ol.js: uncompressed: 247596 bytes
2013-07-12 10:37:32,555 build/ol.js:   compressed: 79330 bytes

So the difference is 98 bytes (gzipped). Exports shouldn't cost much, as long as the symbols/properties we export are already used internally. In that case, the extra bytes are related to the aliases created only.

@fredj
Copy link
Member

fredj commented Jul 18, 2013

+1

@elemoine
Copy link
Member Author

Thanks @fredj. Merging.

elemoine pushed a commit that referenced this pull request Jul 18, 2013
@elemoine elemoine merged commit 4e10128 into openlayers:master Jul 18, 2013
@elemoine elemoine deleted the exports branch July 18, 2013 11:22
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.

None yet

2 participants