Skip to content

Instantly share code, notes, and snippets.

@Orbifold
Created October 6, 2014 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Orbifold/1cfa52e434652cf7d9c9 to your computer and use it in GitHub Desktop.
Save Orbifold/1cfa52e434652cf7d9c9 to your computer and use it in GitHub Desktop.
yFiles module nesting
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";
*/
@Orbifold
Copy link
Author

Orbifold commented Oct 6, 2014

The yFiles documentation does not explicitly say you can nest modules but it all works well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment