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

Usage in RequireJS/AMD? #114

Closed
hultberg opened this issue Apr 26, 2016 · 4 comments
Closed

Usage in RequireJS/AMD? #114

hultberg opened this issue Apr 26, 2016 · 4 comments

Comments

@hultberg
Copy link

Could you please provide an example on how the function svg4everybody() is to be used within an RequireJS/AMD environment bundled with webpack? All I'm getting is undefined. Tried putting svg4everybody in a module like this;

define('svg4everybody-amd', ['svg4everybody'], function(svg) {
  return function() { svg4everybody(); }
});

But, the code is not runned when using:

entry.js

require('svg4everybody-amd');

Am I missing something here?

@hultberg hultberg changed the title Usage in AMD? Usage in RequireJS/AMD? Apr 26, 2016
@clemsontiger
Copy link

yes, I'd like to know how to get this working with requirejs as well. thanks.

@MikaelLambert
Copy link

MikaelLambert commented Jun 21, 2016

@hultberg The fixed version is below:

define('svg4everybody-amd', ['svg4everybody'], function(svg4everybody) {
   svg4everybody();
});

@hultberg
Copy link
Author

Thanks @MikaelLambert, that worked! 👍

@rafalradomski
Copy link

I trying use it in angularjs project with RequireJS, I see library is in place:

svg4everybody

svg4everybody(rawopts) { function oninterval() { // while the index exists in the live <use> collection for (// get the cached <use> index var …

but when I call function I get

svg4everybody();

undefind

I using leatest version 2.1 and angularJS 1.5 any ideas how to fix it?

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

4 participants