jsface
jsface copied to clipboard
noConflict does not solve all conflicts
Hi buddy, this is not enough:
oldClass = context.Class; // save current Class namespace
context.Class = Class; // bind Class and jsface to global scope
context.jsface = jsface;
jsface.noConflict = function() { context.Class = oldClass; }; // no conflict
noConflict
"pattern" should allow to preserve global context from pollution completely, you'll need to backup and return jsface too:
oldClass = context.Class; // save current Class namespace
context.Class = Class; // bind Class and jsface to global scope
var oldJsface = context.jsface;
context.jsface = jsface;
jsface.noConflict = function() {
context.Class = oldClass;
context.jsface = oldJsface;
return jsface;
}; // no conflict
Now people can use noConflict
like this:
var Class = jsface.noConflict().Class;
If you review this comment I can make a PR for you.
Actually was too easy to submit a PR: #34
Is this project dead?
@mcasimir, I think it's overdone to save and restore jsface. Given development of tooling like webpack and browsersify, commonjs is now supported when you develop javascript for front-end, noConflict becomes less and less useful.