-
Notifications
You must be signed in to change notification settings - Fork 29
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
AMD pattern #3
Comments
Hm. I wonder if there's a way to do this where the minified size is still < 500b. Perhaps a way to make a specialized |
What do you think? I'm not sure I got the AMD pattern right, but since P has no dependencies, I believe I can just do the |
Alright, I'm pretty satisfied with the outcome. Run What I recommend, though, is that since the lib is so small, you may just want to concatenate or inline it with some other JS files. The default |
Thanks for your work on this so far! There is a problem however, define() is better without 'pjs' defined and it should be a function that returns the P object like so: define(function () { return P; }); However you are still defining P in global scope within the browser environment so even if you fix p.amd.js there is still that problem. I understand what us developers are like wanting to keep a file size down, and make boilerplate as minimal as possible so I can appreciate what you did with the Makefile. I have half fixed the issue although I missed out on fixing the Makefile due to lack of knowledge :P See #4 |
It would be nice if you could support the AMD pattern as well as the CommonJS module pattern so that I can load this file using require.js or curl.js client side.
Take the example of Klass for example: https://github.com/ded/klass/blob/master/klass.js
Dustin does this:
More info on AMD: https://github.com/amdjs/amdjs-api/wiki/AMD
The text was updated successfully, but these errors were encountered: