Move constants for better reuse
Merge pull request #1274 from markewallace/LibraryGenerateJavaScript

Library javascript generation