Git Product home page Git Product logo

Comments (16)

rgrove avatar rgrove commented on July 30, 2024

var MyNameSpace = YUI;

from yui3.

trungpham avatar trungpham commented on July 30, 2024

what if I already have something called YUI on my page?

Then when I load the YUI library, it will override it.

One possible use case is being able to support multiple versions of YUI on the same page.

from yui3.

trungpham avatar trungpham commented on July 30, 2024

I guess I can hack it by globally replacing 'YUI' with 'MyNamespace' in the source code. But it's still a hack.

from yui3.

davglass avatar davglass commented on July 30, 2024

You can use shifter to make a custom build:

cd yui3/src
shifter --walk --replace-yuiglobalvar=FOO

Then you can do one of two things:

Hand modify the global in build/yui/yui.js

OR

<script>
var exports = {};
</script>
<script src="/path/to/your/yui.js"></script>
<script>
var FOO = exports.YUI;
</script>

from yui3.

trungpham avatar trungpham commented on July 30, 2024

How is shifter going to find @YUIGLOBALVAR@? I can't find this place holder anywhere in the source code.

from yui3.

davglass avatar davglass commented on July 30, 2024

When shifter builds the lib with that command, it will wrap the code
in YUI.add. YUI is a variable in shifter.

from yui3.

trungpham avatar trungpham commented on July 30, 2024

Gotcha.

@YUIGLOBALVAR@ is in shifter, and the remaining offender is src/yui/js/yui.js

Will you consider a patch to make the YUI global variable configurable?

Anyway, thank you for your help.

from yui3.

davglass avatar davglass commented on July 30, 2024

Yup, we should make that configurable.

There may be some edge cases in other modules that use the YUI var too.

I'll also keep that in mind with the seed rewrite I'm working on.

from yui3.

trungpham avatar trungpham commented on July 30, 2024

Hi Dave,

I started the work on making YUI global variable configurable.

Can you let me know if I am headed down the right road? Thanks.

trungpham@c939272

from yui3.

davglass avatar davglass commented on July 30, 2024

Changing them from YUI to Y is not the proper thing. Changing them from YUI to @YUIGLOBALVAR is the best thing.

from yui3.

trungpham avatar trungpham commented on July 30, 2024

Is it possible to use an alternative marker to indicate a place holder variable? Because using the @ sign confuses most IDEs since variable name cannot start with the @ sign.

Perhaps, $YUIGLOBALVAR$?

from yui3.

davglass avatar davglass commented on July 30, 2024

Just hold off on this for now, we discussed this on a Hangout on
Friday. I think I have the proper way to fix this lined out in my new
seed changes.

from yui3.

trungpham avatar trungpham commented on July 30, 2024

Awesome!

from yui3.

trungpham avatar trungpham commented on July 30, 2024

@davglass hi Dave, is there any update on this?

from yui3.

alaindresse avatar alaindresse commented on July 30, 2024

Any update on this ?

from yui3.

ezequiel avatar ezequiel commented on July 30, 2024

@alaindresse, @trungpham

It sucks this issue was not addressed, and left to rot. Unfortunately, I don't believe there are any current plans for this feature. However, this may be resolved next sprint (starting Nov. 15th).

from yui3.

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.