Explorar el Código

custom nodes: on -> once event emitter change

sanex3339 hace 8 años
padre
commit
c56f2e6d9f
Se han modificado 2 ficheros con 2 adiciones y 2 borrados
  1. 1 1
      dist/index.js
  2. 1 1
      src/Obfuscator.ts

+ 1 - 1
dist/index.js

@@ -1677,7 +1677,7 @@ var Obfuscator = function () {
             NodeUtils_1.NodeUtils.parentize(astTree);
             this.customNodesStorage.initialize(this.stackTraceAnalyzer.analyze(astTree.body));
             this.customNodesStorage.getStorage().forEach(function (customNode) {
-                _this.obfuscationEventEmitter.on(customNode.getAppendEvent(), customNode.appendNode.bind(customNode));
+                _this.obfuscationEventEmitter.once(customNode.getAppendEvent(), customNode.appendNode.bind(customNode));
             });
             this.obfuscationEventEmitter.emit(ObfuscationEvents_1.ObfuscationEvents.BeforeObfuscation, astTree);
             if (this.options.controlFlowFlattening) {

+ 1 - 1
src/Obfuscator.ts

@@ -77,7 +77,7 @@ export class Obfuscator implements IObfuscator {
         this.customNodesStorage
             .getStorage()
             .forEach((customNode: ICustomNode) => {
-                this.obfuscationEventEmitter.on(customNode.getAppendEvent(), customNode.appendNode.bind(customNode));
+                this.obfuscationEventEmitter.once(customNode.getAppendEvent(), customNode.appendNode.bind(customNode));
             });
 
         this.obfuscationEventEmitter.emit(ObfuscationEvents.BeforeObfuscation, astTree);