Development > Organization > Good practices > Standards...
SSP is a easy way to modularize and organize your project. Bringing the idea of OOP to JS, but in a simple way.
Using it you gain:
- Readability
- Understanding of the parties
- Modularization
- Reuse
- Adaptability
28. { → SSP - PROPERTIES / _nameSpace }
// All modules have a property called nameSpace that
// returning string the name of module.
SSP.MyModule = {
setUp: function() {
var self = this;
console.debug(self._nameSpace);
// return -> "SSP.MyModule"
}
}
29. { → SSP - METHODS / .setUp( ) }
// SetUp is a Main method.
// It always runs when the father's module is called.
SSP.MyModule = {
setUp: function() {
console.debug(‘My SSP Module is running!’);
// return -> "My SSP Module is running!"
}
}
30. { → SSP - METHODS / .init( ) }
// This method initialize all modules from your application.
SSP.init();
SSP.init(SSP.MyModule);
SSP.init(SSP.MyModule, SSP.MyOtherModule);
31. { → SSP - METHODS / .applyByNamespace(‘namespace’, params) }
// Using this you can run a method that's located in other
// module/part from your application, but using `_namespace`.
// For example:
SSP.applyByNamespace(‘SSP.MyModule');
// SSP.MyModule();
32. { → SSP - METHODS / .applyByNamespace(‘namespace’, params) }
// Using this you can run a method that's located in other
// module/part from your application, but using `_namespace`.
// For example:
SSP.applyByNamespace(‘SSP.MyModule’, SomeParameter);
// SSP.MyModule(SomeParameter);