Created
May 10, 2012 14:36
-
-
Save Gozala/2653451 to your computer and use it in GitHub Desktop.
Spring cleaning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var self = require('self') | |
var utils = require('my-library/utils') | |
console.log(self.data.url('icon.png')) | |
console.log(utils.url('icon.png')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var self = require('self') | |
exports.url = function(path) { | |
return self.data.url(path) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Imagine you have following file layout:
where source of my-addon/lib/main.js and my-library/lib/utils.js is shown above. Before
spring cleaning execution of
cfx run
from my-addon directory would have logged two different URLs one pointing to a file in themy-addon/data/
folder and another to a file inmy-library/data/
. After spring cleaningcfx run
will log same URL twice, that's becauseself
will be the same regardless of package module is coming from.