@pnp/core-commonjs
Advanced tools
Comparing version 3.0.0-v3nightly.20211029 to 3.0.0-v3nightly.20211030
@@ -5,5 +5,2 @@ "use strict"; | ||
const util_js_1 = require("./util.js"); | ||
// TODO:: docs | ||
// - you don't need error handling here because that is handled in emit within the timeline | ||
// - explain why we have just these - it is what we needed. | ||
/** | ||
@@ -10,0 +7,0 @@ * Emits to all registered observers the supplied arguments. Any values returned by the observers are ignored |
{ | ||
"name": "@pnp/core-commonjs", | ||
"version": "3.0.0-v3nightly.20211029", | ||
"version": "3.0.0-v3nightly.20211030", | ||
"description": "pnp - provides shared functionality across all pnp libraries", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -176,3 +176,2 @@ "use strict"; | ||
get session() { | ||
// BUG: sessionStorage is undefined | ||
if (this._session === null) { | ||
@@ -179,0 +178,0 @@ this._session = new PnPClientStorageWrapper(typeof sessionStorage === "undefined" ? new MemoryStorage() : sessionStorage); |
@@ -84,7 +84,2 @@ /** | ||
/** | ||
* Shorthand method to emit a dispose event tied to this timeline | ||
* | ||
*/ | ||
protected dispose(): void; | ||
/** | ||
* Shorthand method to emit an error event tied to this timeline | ||
@@ -96,7 +91,2 @@ * | ||
/** | ||
* Shorthand method to emit an init event tied to this timeline | ||
* | ||
*/ | ||
protected init(): void; | ||
/** | ||
* Property allowing access to invoke a moment from within this timeline | ||
@@ -103,0 +93,0 @@ */ |
@@ -74,9 +74,2 @@ "use strict"; | ||
/** | ||
* Shorthand method to emit a dispose event tied to this timeline | ||
* | ||
*/ | ||
dispose() { | ||
this.emit.dispose(); | ||
} | ||
/** | ||
* Shorthand method to emit an error event tied to this timeline | ||
@@ -92,9 +85,2 @@ * | ||
/** | ||
* Shorthand method to emit an init event tied to this timeline | ||
* | ||
*/ | ||
init() { | ||
this.emit.init(); | ||
} | ||
/** | ||
* Property allowing access to invoke a moment from within this timeline | ||
@@ -106,9 +92,7 @@ */ | ||
get: (target, p) => (...args) => { | ||
// handle the case there are no observers registered to the target | ||
// handle the case where no observers registered for the target moment | ||
const observers = Reflect.has(target.observers, p) ? Reflect.get(target.observers, p) : []; | ||
if (!(0, util_js_1.isArray)(observers) || observers.length < 1) { | ||
if (p === "error") { | ||
// if we are emitting an error, and no error observers are defined, we throw | ||
throw Error(`Unhandled Exception: ${args[0]}`); | ||
} | ||
if ((!(0, util_js_1.isArray)(observers) || observers.length < 1) && p === "error") { | ||
// if we are emitting an error, and no error observers are defined, we throw | ||
throw Error(`Unhandled Exception: ${args[0]}`); | ||
} | ||
@@ -118,2 +102,3 @@ try { | ||
const moment = Reflect.has(target.moments, p) ? Reflect.get(target.moments, p) : p === "init" || p === "dispose" ? (0, moments_js_1.lifecycle)() : (0, moments_js_1.broadcast)(); | ||
// pass control to the individual moment's implementation | ||
return Reflect.apply(moment, target, [observers, ...args]); | ||
@@ -146,12 +131,11 @@ } | ||
// initialize our timeline | ||
this.init(); | ||
this.emit.init(); | ||
// execute the timeline | ||
// (this await is required to ensure dispose is called AFTER execute completes) | ||
// we do not catch here so that any promise rejects in execute bubble up to the caller | ||
return await this.execute(init); | ||
} | ||
catch (e) { | ||
this.error(e); | ||
} | ||
finally { | ||
try { | ||
this.dispose(); | ||
this.emit.dispose(); | ||
} | ||
@@ -158,0 +142,0 @@ catch (e) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78781
1269