adlnet / xAPIWrapper

Wrapper to simplify communication to an LRS
https://adlnet.gov/projects/xapi/
Apache License 2.0
219 stars 114 forks source link

Implement as a RequireJS module if available #60

Closed Rycochet closed 7 years ago

Rycochet commented 8 years ago

Rather than forcing the namespace this would let it work properly with modern good practices - there's various patterns, but basically if there's no define function defined then nothing changes, otherwise it should effectively have define(function(){return ADL;}) - but possibly without using the global namespace at all.

creighton commented 8 years ago

Thanks for bringing this up. We'll add it to our todos

srad commented 8 years ago

A colleague just brought this ticket to my attention.

I recently forked your code and created an "AMD" branch and refactored the whole code into requirejs modules to use it in the future in our code.

It also unveiled some design issues and globally leaking variables which I largely fixed. This could certainly also be made compatible with non-requirejs environtments, since the modules can (and are) compiled into a single minified file: https://github.com/srad/xAPIWrapper/tree/amd

Rycochet commented 8 years ago

@srad Brilliant timing lol - can't be a straight merge though since you've taken out various required bit of the Gruntfile/package.json (even though the doxstrap usage is broken on Windows) - hopefully most can be incorporated :-)

zpetterd commented 8 years ago

I've converted it over to a Node module, I still need to develop so comprehensive tests before merging it back into this repo.

You can install it using npm install https://github.com/zapur1/xAPIWrapper.git

It will also attach to the window if not imported using Node JS, instead including as <script> directly from source

ljwolford commented 7 years ago

@zapur1 : Have there been any updates to a completed node module with tests?

zpetterd commented 7 years ago

Kind of... I ended up having to rewrite most of the structure to mean it can work in both a browser and Node JS environment alike. In the end I just used https://github.com/RusticiSoftware/TinCanJS as it works right out of the box

On Thu, 9 Mar 2017, 5:57 AM Lou Wolford notifications@github.com wrote:

@zapur1 https://github.com/zapur1 : Have there been any updates to a completed node module with tests?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/adlnet/xAPIWrapper/issues/60#issuecomment-285133634, or mute the thread https://github.com/notifications/unsubscribe-auth/ABzk9qrrn0JyLuXXhA71W0usfnS1HxqSks5rjvoXgaJpZM4HD6lO .