All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bower_components.jszip.lib.stream.GenericWorker.min.js Maven / Gradle / Ivy

There is a newer version: 0.66.0.1
Show newest version
"use strict";function GenericWorker(name){this.name=name||"default";this.streamInfo={};this.generatedError=null;this.extraStreamInfo={};this.isPaused=true;this.isFinished=false;this.isLocked=false;this._listeners={data:[],end:[],error:[]};this.previous=null}GenericWorker.prototype={push:function(chunk){this.emit("data",chunk)},end:function(){if(this.isFinished){return false}this.flush();try{this.emit("end");this.cleanUp();this.isFinished=true}catch(e){this.emit("error",e)}return true},error:function(e){if(this.isFinished){return false}if(this.isPaused){this.generatedError=e}else{this.isFinished=true;this.emit("error",e);if(this.previous){this.previous.error(e)}this.cleanUp()}return true},on:function(name,listener){this._listeners[name].push(listener);return this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null;this._listeners=[]},emit:function(name,arg){if(this._listeners[name]){for(var i=0;i "+me}else{return me}}};module.exports=GenericWorker;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy