TinyMCE:API/tinymce/create
From Moxiecode Documentation Wiki
< TinyMCE:API | tinymce
Contents |
[edit]
Method: create
[edit]
Summary
Creates a class, subclass or static singleton. This method is used to create all classes within the TinyMCE API. This method enables you do OOP easy but powerful way.
[edit]
Syntax
<void> create(<String> s, <Object> o)
[edit]
Parameters
- s
- Class name, inheritage and prefix.
- o
- Collection of methods to add to the class.
[edit]
Examples
// Creates a basic class
tinymce.create('tinymce.somepackage.SomeClass', {
SomeClass : function() {
// Class constructor
},
method : function() {
// Some method
}
});
// Creates a basic subclass class
tinymce.create('tinymce.somepackage.SomeSubClass:tinymce.somepackage.SomeClass', {
SomeSubClass: function() {
// Class constructor
this.parent(); // Call parent constructor
},
method : function() {
// Some method
this.parent(); // Call parent method
},
'static' : {
staticMethod : function() {
// Static method
}
}
});
// Creates a singleton/static class
tinymce.create('static tinymce.somepackage.SomeSingletonClass', {
method : function() {
// Some method
}
});
