Browse Source

Merge pull request #19977 from ianpurvis/layers-es6-class

Layers: Convert to es6 class
Mr.doob 5 years ago
parent
commit
4019db7740
1 changed files with 18 additions and 18 deletions
  1. 18 18
      src/core/Layers.js

+ 18 - 18
src/core/Layers.js

@@ -1,54 +1,54 @@
-function Layers() {
+class Layers {
 
-	this.mask = 1 | 0;
+	constructor() {
 
-}
+		this.mask = 1 | 0;
 
-Object.assign( Layers.prototype, {
+	}
 
-	set: function ( channel ) {
+	set( channel ) {
 
 		this.mask = 1 << channel | 0;
 
-	},
+	}
 
-	enable: function ( channel ) {
+	enable( channel ) {
 
 		this.mask |= 1 << channel | 0;
 
-	},
+	}
 
-	enableAll: function () {
+	enableAll() {
 
 		this.mask = 0xffffffff | 0;
 
-	},
+	}
 
-	toggle: function ( channel ) {
+	toggle( channel ) {
 
 		this.mask ^= 1 << channel | 0;
 
-	},
+	}
 
-	disable: function ( channel ) {
+	disable( channel ) {
 
 		this.mask &= ~ ( 1 << channel | 0 );
 
-	},
+	}
 
-	disableAll: function () {
+	disableAll() {
 
 		this.mask = 0;
 
-	},
+	}
 
-	test: function ( layers ) {
+	test( layers ) {
 
 		return ( this.mask & layers.mask ) !== 0;
 
 	}
 
-} );
+}
 
 
 export { Layers };