2

I'm using Zone.js with a project to handle async functionalities, I'm reading the source code and how they related, but still new to understand how all functions likes runGuarded help me to handle async stuffs, anybody using Zone.js before separately to help the project, I'm interested to know more about everything know specially how runGuarded works in zone, here is the snippet from the source if anybody can explain:

  Zone.prototype.runGuarded = function (callback, applyThis, applyArgs, source) {
            if (applyThis === void 0) { applyThis = null; }
            if (applyArgs === void 0) { applyArgs = null; }
            if (source === void 0) { source = null; }
            _currentZoneFrame = { parent: _currentZoneFrame, zone: this };
            try {
                try {
                    return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
                }
                catch (error) {
                    if (this._zoneDelegate.handleError(this, error)) {
                        throw error;
                    }
                }
            }
            finally {
                _currentZoneFrame = _currentZoneFrame.parent;
      }
   };
Alireza
  • 100,211
  • 27
  • 269
  • 172

0 Answers0