grofit / aurelia-chart

A chart element for aurelia which is powered by chart js using html5 canvas.
MIT License
46 stars 25 forks source link

aurelia.globalizeResources no longer works #4

Closed alexmahterian closed 8 years ago

alexmahterian commented 8 years ago

Hey there! I'm attempting to use chartjs with my Application, and I'm seeing this error:

' TypeError: aurelia.globalizeResources is not a function(…) '

So I investigated the index file and found:

function configure(aurelia) { aurelia.globalizeResources("./elements/chart-element"); aurelia.globalizeResources("./attributes/chart-attribute"); }

I changed this to

function configure(aurelia) { aurelia.use.globalResources("./elements/chart-element"); aurelia.use.globalResources("./attributes/chart-attribute"); }

since that seems to be the recent syntactical change. Then I see this error:

' Uncaught (in promise) TypeError: Cannot read property 'globalResources' of undefined(…) '

So, I investigated the actual Aurelia object:

FrameworkConfiguration {aurelia: Aurelia, container: Container, info: Array[0], processed: false, preTasks: Array[0]…} aurelia: Aurelia bootstrapperName: "http://localhost:9000/jspm_packages/npm/aurelia-bootstrapper@1.0.0-beta.1.1.4.js" container: Container info: Array[0] postTasks: Array[1] preTasks: Array[0] processed: false resourcesRelativeTo: "grofit/aurelia-chart" resourcesToLoad: Object __proto__: FrameworkConfiguration

There is no 'use' field for this object. The second-tier aurelia level shows a 'use' field, but no function called globalizeResources or globalResource or globalResources.

Any idea what I should change this to?

grofit commented 8 years ago

I imagine it is because like you say Aurelia has updated and changed its syntax and this library is dependent on an old version of Aurelia. To fix it you probably just need to update the Aurelia version in the jspm dependencies and use your new syntax.

I don't tend to do much with these libs as I found trying to test this stuff a nightmare as JSPM doesn't work well with local file dependencies so I couldn't find a way to have an example page which referenced the local source code as a module so I could only test it after it was released to github, which became a pain.

So feel free to fork and or just try updating the dependencies locally and see if that works, if you can get anyone to give an example of loading modules from local files with aurelia so I can make actual example html pages within the source (like I do with the knockout versions of these libs) I am more than happy to try and fix it myself and update, but I have asked SOOOOOO many times on the Aurelia gitter if anyone can assist with this and no one seems to be able to provide a working example or advice so if they cannot help me support the plugins for their framework I cannot justify spending time to fix plugins I cannot test in a nice way.

If you look at the other issues raised here you can see that I have tried MANY times to get some assistance from the Aurelia bods with little to show for it.

https://github.com/grofit/aurelia-chart/issues/3

grofit commented 8 years ago

This should work fine, I have just done a new release and the latest version of aurelia seems to work fine with globalize resource.

Try using version 0.1.0: https://github.com/grofit/aurelia-chart/releases/tag/0.1.0