Procházet zdrojové kódy

custom nodes: on -> once event emitter change

sanex3339 před 8 roky
rodič
revize
c56f2e6d9f
2 změnil soubory, kde provedl 2 přidání a 2 odebrání
  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);