Created
October 6, 2014 12:19
-
-
Save Orbifold/1cfa52e434652cf7d9c9 to your computer and use it in GitHub Desktop.
yFiles module nesting
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
yfiles.module("Life", function (exports) { | |
var Person = Class('Person', | |
{ | |
constructor: function (name) { | |
this.name = name; | |
}, | |
toString: function () { | |
return this.name; | |
} | |
}); | |
exports.Person = Person; | |
}); | |
yfiles.module("Life.Special", function (exports) { | |
function say() { | |
console.log("Adding modules at a deeper level works too."); | |
return true; | |
} | |
var Genius = Class("Genius", { | |
$extends: Life.Person, | |
constructor: function () { | |
Life.Person.call(this); | |
this._name = "Not set"; | |
}, | |
get name() { | |
return this._name; | |
}, | |
set name(value) { | |
this._name = value; | |
} | |
}); | |
exports.say = say; | |
exports.Genius = Genius; | |
}); | |
/* | |
Life.Special.say(); // returns true | |
var genius = new Life.Special.Genius(); | |
genius.name = "Ramanujan"; | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The yFiles documentation does not explicitly say you can nest modules but it all works well.