Coder Social home page Coder Social logo

Comments (17)

joshghent avatar joshghent commented on June 12, 2024

Great idea @asiyani!

We should probably have an option to add libraries which will open a modal dialogue. We can then have the user put in a link to the JS file they want. In addition to this we can have some preset ones like Lodash etc.

Checkout codepen.io/pen and click on settings > javascript to see what I have in mind.

from esfiddle.

asiyani avatar asiyani commented on June 12, 2024

yes, but problem with adding own library in like in codepen is you need to write some boilerplate code before you can actually do what you wanna do.
Atleast in most used library user should be able to just select library and start writing actual code.
e.g. -> user will select lodash -> then just write console.log( _.now() ) this should work.
So we will have to do all background work like requiring lodash and assigning it to _ var. runkit Link

from esfiddle.

joshghent avatar joshghent commented on June 12, 2024

@asiyani Yeah that sounds a good idea. Yeah I think we can stick with the UI we have but skirt over the boilerplate that codepen requires.

from esfiddle.

ejvelasco avatar ejvelasco commented on June 12, 2024

@joshghent I think we should use jQuery to handle this. This method is perfect for it: http://api.jquery.com/jQuery.getScript/

I can go ahead and implement it, if you want.

from esfiddle.

joshghent avatar joshghent commented on June 12, 2024

from esfiddle.

ejvelasco avatar ejvelasco commented on June 12, 2024

@joshghent I was thinking of doing something like this: http://codepen.io/velascoDev/pen/wgbZQL?editors=1111
but I'm not sure if it would work with the babel compiler.
Idk about just one method, but using this approach: http://developer.telerik.com/featured/jquery-using-only-what-you-need/
we can require only the jQuery AJAX module, which is 13K when compressed.

from esfiddle.

ejvelasco avatar ejvelasco commented on June 12, 2024

As for using the cdnjs API, I'm not sure about how to execute the response file properly. How would you go about that?

from esfiddle.

joshghent avatar joshghent commented on June 12, 2024

@velascoDev Sorry for not getting back to you. I would run a query for the library that the user requested and then get the URL of that library and load it in as a script element.

I'm not 100% sure however as in the case of some libraries there are multiple prerequisites. For example to load bootstrap.js you first need jquery.

I'll have a think about how best to go about this. It could be that we have a table of libraries and a link to their CDN file or something like that? Have you had any more thoughts.

Yeah we could require just that module. I'd prefer if we could do this all in JS but if it significantly helps then that would be the route to go (importing just the methods we need)

from esfiddle.

asiyani avatar asiyani commented on June 12, 2024

found this blog it addes script tag to head and calls callback function
Implemented same using cdnjs Not sure how to load specific version for the best way we can implement that....code pen
I think if we do this way we might have to remove script tag from head once fiddle is done or new fiddle is loaded.

from esfiddle.

joshghent avatar joshghent commented on June 12, 2024

@asiyani Yeah I'm happy with this approach. Is that something you or @velascoDev would be up for doing?

from esfiddle.

humblefool1997 avatar humblefool1997 commented on June 12, 2024

@joshghent is it still open? I am up for it.

from esfiddle.

joshghent avatar joshghent commented on June 12, 2024

@isaeef Yes this is still open, we would really appreciate you're help on this one! Let us know how you get on 👍

from esfiddle.

phsantiago avatar phsantiago commented on June 12, 2024

We can get a js file by xmlhttprequest and eval it, or create a dynamic script tag like @asiyani said

from esfiddle.

joshghent avatar joshghent commented on June 12, 2024

@phsantiago I think a dynamic script tag would work best and be most safe. eval scares me.

Is this something you'd want to take on?

from esfiddle.

jigar1101 avatar jigar1101 commented on June 12, 2024

@joshghent Can you please check #174
Based on the discussion you and @asiyani had, I have added this which can be improved based on your inputs.

from esfiddle.

joshghent avatar joshghent commented on June 12, 2024

@jigar1101 @asiyani Updated the PR with some comments. Looks like it will need catching up with the latest version of the develop branch where I have fixed babel but looks great! 💯 Thank you so much for this work! 🎉

from esfiddle.

jigar1101 avatar jigar1101 commented on June 12, 2024

Great 👍

from esfiddle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.