Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

tweak swfPath config for js module definitions #29

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

alxndr
Copy link

@alxndr alxndr commented Feb 3, 2015

If ZeroClipboard is not in scope when asset-path.js.erb is being run, it will error out with ZeroClipboard is not defined when it tries to set ZeroClipboard.config({ swfPath: '...' }).

This is currently only tested with requirejs-rails, which the first conditional addresses.

* assumes requirejs's `require()` is available if amd `define()`
* node-y method (line 12) not tested
swfPath: <%= image_path("ZeroClipboard.swf").to_json %>
};
if (typeof define === "function" && define.amd) {
require(["ZeroClipboard"], function(ZeroClipboard) {
Copy link
Author

Choose a reason for hiding this comment

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

Is this specific to RequireJS?

or else RequireJS complains about Mismatched anonymous define() module
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant