penguin/AstroJS

Javascript framework for my blog

commit 6e05b2d5c1c3b35ef0ab3a24117f05a4da96ad9d

author斟酌 鵬兄 <tgckpg@gmail.com>
date2017-09-26T05:05:45Z
subjectRemove __getter method, use __readOnly instead
commit 6e05b2d5c1c3b35ef0ab3a24117f05a4da96ad9d
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2017-09-26T05:05:45Z

    Remove __getter method, use __readOnly instead
---
 botanjs/src/_this.js | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/botanjs/src/_this.js b/botanjs/src/_this.js
index 5152227..cfb3b66 100644
--- a/botanjs/src/_this.js
+++ b/botanjs/src/_this.js
@@ -13,15 +13,6 @@ var __readOnly = function( prototype, name, callback )
 		}.bind( { p: name } )
 	} );
 };
-var __getter = function( obj, name, callback )
-{
-	Object.defineProperty( obj, name, {
-		get: callback
-		, set: function( v ) {
-			throw new Error( "Setting a read-only property: " + this.p );
-		}.bind( { p: name } )
-	} );
-};
 var __static_method = function( obj, name, callback )
 {
 	Object.defineProperty( obj, name, {
@@ -54,20 +45,14 @@ var BotanEvent = function( name, data )
 
 	__static_method(
 	   this, "stopPropagating"
-	   , function()
-	   {
-		   __propagating = false;
-	   }
+	   , function() { __propagating = false; }
 	);
 
 	__const( this, "type", name );
 
-	__getter(
+	__readOnly(
 		this, "propagating"
-		, function()
-		{
-			return __propagating;
-		}
+		, function() { return __propagating; }
 	);
 
 	__const( this, "data", data );