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

Support AMD #111

Merged
merged 14 commits into from
May 24, 2014
Merged

Support AMD #111

merged 14 commits into from
May 24, 2014

Conversation

le0pard
Copy link
Member

@le0pard le0pard commented May 20, 2014

// cc @bogdan

@le0pard le0pard mentioned this pull request May 20, 2014
ParameterMissing:: = new Error()
defaults =
prefix: "PREFIX"
defaultUrlOptions: DEFAULT_URL_OPTIONS
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like you've changed API here. As I remember JsRoutes.defaults is accessible and they are no longer backward compatible.

@bogdan
Copy link
Collaborator

bogdan commented May 21, 2014

General question: Can we avoid a reindenting of entire file - it makes blame history unaccessible. So I would want to avoid that if possible.

@le0pard le0pard changed the title Support AMD and change JS to camelCase Support AMD May 21, 2014
@le0pard
Copy link
Member Author

le0pard commented May 21, 2014

Results: http://jsfiddle.net/8G5yW/2/

Files:

<script data-main="https://dl.dropboxusercontent.com/u/930565/js-routes/main.js" src="http://requirejs.org/docs/release/2.1.11/minified/require.js"></script>

In main we have config:

require.config({
  paths: {
    "js-routes": "https://dl.dropboxusercontent.com/u/930565/js-routes/routes"
  },
  shim: {
    "js-routes": {
      exports: "Routes"
    }
  }
});

require(["js-routes"], function(r) {
  alert([Routes.edit_inbox_message_path("cool", "route"), r.edit_inbox_message_path("cool", "route")].join(" == "));
});

And see this alert :)

Files:

bogdan added a commit that referenced this pull request May 24, 2014
@bogdan bogdan merged commit 8fad914 into railsware:master May 24, 2014
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