/ Published in: ActionScript 3
Expand |
Embed | Plain Text
package ###PACKAGE_PATH### { private static var _instance:###CLASS_NAME###; public class ###CLASS_NAME### { public static function getInstance():###CLASS_NAME### { if ( !_instance ) _instance = new ###CLASS_NAME###( new SingletonEnforcer() ); return _instance; } public function ###CLASS_NAME###( se:SingletonEnforcer ) { if ( !se ) throw( new Error( "use ###CLASS_NAME###.getInstance() instead!!" ) ); } } } class SingletonEnforcer{}
You need to login to post a comment.
