@pnp/core
Advanced tools
Comparing version 3.0.0-v3nightly.20211029 to 3.0.0-v3nightly.20211030
import { isArray } from "./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. | ||
/** | ||
@@ -6,0 +3,0 @@ * Emits to all registered observers the supplied arguments. Any values returned by the observers are ignored |
{ | ||
"name": "@pnp/core", | ||
"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", |
@@ -172,3 +172,2 @@ import { dateAdd, jsS, objectDefinedNotNull } from "./util.js"; | ||
get session() { | ||
// BUG: sessionStorage is undefined | ||
if (this._session === null) { | ||
@@ -175,0 +174,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 @@ */ |
@@ -70,9 +70,2 @@ import { broadcast, lifecycle } from "./moments.js"; | ||
/** | ||
* 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 | ||
@@ -88,9 +81,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 | ||
@@ -102,9 +88,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 (!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 ((!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]}`); | ||
} | ||
@@ -114,2 +98,3 @@ try { | ||
const moment = Reflect.has(target.moments, p) ? Reflect.get(target.moments, p) : p === "init" || p === "dispose" ? lifecycle() : broadcast(); | ||
// pass control to the individual moment's implementation | ||
return Reflect.apply(moment, target, [observers, ...args]); | ||
@@ -142,12 +127,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(); | ||
} | ||
@@ -154,0 +138,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
76088
1215