bruce-models 4.7.8 → 4.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bruce-models.es5.js +68 -63
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +68 -63
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/environment.js +6 -0
- package/dist/lib/environment.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/environment.d.ts +2 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -1585,6 +1585,68 @@
|
|
|
1585
1585
|
}
|
|
1586
1586
|
}
|
|
1587
1587
|
|
|
1588
|
+
/**
|
|
1589
|
+
* Simple event utility.
|
|
1590
|
+
* Instantiate the model, then subscribe and trigger events.
|
|
1591
|
+
*/
|
|
1592
|
+
class BruceEvent {
|
|
1593
|
+
constructor() {
|
|
1594
|
+
// Counter to help differentiate subscriptions.
|
|
1595
|
+
this._counter = 0;
|
|
1596
|
+
// Record of all callback subscriptions for this event.
|
|
1597
|
+
this.callbacks = [];
|
|
1598
|
+
}
|
|
1599
|
+
/**
|
|
1600
|
+
* Subscribes to this event.
|
|
1601
|
+
* The provided callback will be called when the event is triggered.
|
|
1602
|
+
* @param callback
|
|
1603
|
+
* @returns A function that can be called to unsubscribe from this event.
|
|
1604
|
+
*/
|
|
1605
|
+
Subscribe(callback) {
|
|
1606
|
+
let id = this._counter++;
|
|
1607
|
+
let newBruceEventCallback = {
|
|
1608
|
+
_id: id,
|
|
1609
|
+
removeCallback: () => {
|
|
1610
|
+
this.Unsubscribe(id);
|
|
1611
|
+
},
|
|
1612
|
+
callback: callback
|
|
1613
|
+
};
|
|
1614
|
+
this.callbacks.push(newBruceEventCallback);
|
|
1615
|
+
return newBruceEventCallback.removeCallback;
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* Unsubscribes from this event.
|
|
1619
|
+
* @param id specific subscription entry to remove.
|
|
1620
|
+
* @warning please use the returned function from Subscribe() instead of this function.
|
|
1621
|
+
*/
|
|
1622
|
+
Unsubscribe(id) {
|
|
1623
|
+
let index = this.callbacks.findIndex(x => x._id == id);
|
|
1624
|
+
if (index > -1) {
|
|
1625
|
+
this.callbacks.splice(index, 1);
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
/**
|
|
1629
|
+
* Triggers this event with optional data.
|
|
1630
|
+
* This will call all subscribed callbacks.
|
|
1631
|
+
* @param data
|
|
1632
|
+
*/
|
|
1633
|
+
Trigger(data) {
|
|
1634
|
+
let callbacks = this.callbacks;
|
|
1635
|
+
for (let i = 0; i < callbacks.length; i++) {
|
|
1636
|
+
let callback = callbacks[i];
|
|
1637
|
+
if (callback.callback) {
|
|
1638
|
+
callback.callback(data);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* Clears all subscriptions.
|
|
1644
|
+
*/
|
|
1645
|
+
Clear() {
|
|
1646
|
+
this.callbacks = [];
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1588
1650
|
// Global instance for smaller use-cases where you don't want to manage the getters yourself.
|
|
1589
1651
|
let _getters;
|
|
1590
1652
|
(function (ENVIRONMENT) {
|
|
@@ -1599,6 +1661,9 @@
|
|
|
1599
1661
|
// Default session ID.
|
|
1600
1662
|
sessionId: ""
|
|
1601
1663
|
};
|
|
1664
|
+
// Subscribe to get notified when someone calls Reset.
|
|
1665
|
+
// If you are manually updating params, call OnParamsChange.Trigger() to notify others.
|
|
1666
|
+
ENVIRONMENT.OnParamsChange = new BruceEvent();
|
|
1602
1667
|
/**
|
|
1603
1668
|
* Returns the ApiGetters instance.
|
|
1604
1669
|
* This is used to communicate with any Nextspace API instance.
|
|
@@ -1623,6 +1688,7 @@
|
|
|
1623
1688
|
* @param params
|
|
1624
1689
|
*/
|
|
1625
1690
|
function Reset(params) {
|
|
1691
|
+
var _a;
|
|
1626
1692
|
if (ENVIRONMENT.IS_SELF_MANAGED) {
|
|
1627
1693
|
throw ("Self managed mode ON. You are getting this error because you didn't pass an Api instance to a function.");
|
|
1628
1694
|
}
|
|
@@ -1639,6 +1705,7 @@
|
|
|
1639
1705
|
}
|
|
1640
1706
|
}
|
|
1641
1707
|
ENVIRONMENT.PARAMS = Object.assign(Object.assign({}, ENVIRONMENT.PARAMS), params);
|
|
1708
|
+
(_a = ENVIRONMENT.OnParamsChange) === null || _a === void 0 ? void 0 : _a.Trigger();
|
|
1642
1709
|
}
|
|
1643
1710
|
ENVIRONMENT.Reset = Reset;
|
|
1644
1711
|
})(exports.ENVIRONMENT || (exports.ENVIRONMENT = {}));
|
|
@@ -4948,68 +5015,6 @@
|
|
|
4948
5015
|
Bounds.FromEntity = FromEntity;
|
|
4949
5016
|
})(exports.Bounds || (exports.Bounds = {}));
|
|
4950
5017
|
|
|
4951
|
-
/**
|
|
4952
|
-
* Simple event utility.
|
|
4953
|
-
* Instantiate the model, then subscribe and trigger events.
|
|
4954
|
-
*/
|
|
4955
|
-
class BruceEvent {
|
|
4956
|
-
constructor() {
|
|
4957
|
-
// Counter to help differentiate subscriptions.
|
|
4958
|
-
this._counter = 0;
|
|
4959
|
-
// Record of all callback subscriptions for this event.
|
|
4960
|
-
this.callbacks = [];
|
|
4961
|
-
}
|
|
4962
|
-
/**
|
|
4963
|
-
* Subscribes to this event.
|
|
4964
|
-
* The provided callback will be called when the event is triggered.
|
|
4965
|
-
* @param callback
|
|
4966
|
-
* @returns A function that can be called to unsubscribe from this event.
|
|
4967
|
-
*/
|
|
4968
|
-
Subscribe(callback) {
|
|
4969
|
-
let id = this._counter++;
|
|
4970
|
-
let newBruceEventCallback = {
|
|
4971
|
-
_id: id,
|
|
4972
|
-
removeCallback: () => {
|
|
4973
|
-
this.Unsubscribe(id);
|
|
4974
|
-
},
|
|
4975
|
-
callback: callback
|
|
4976
|
-
};
|
|
4977
|
-
this.callbacks.push(newBruceEventCallback);
|
|
4978
|
-
return newBruceEventCallback.removeCallback;
|
|
4979
|
-
}
|
|
4980
|
-
/**
|
|
4981
|
-
* Unsubscribes from this event.
|
|
4982
|
-
* @param id specific subscription entry to remove.
|
|
4983
|
-
* @warning please use the returned function from Subscribe() instead of this function.
|
|
4984
|
-
*/
|
|
4985
|
-
Unsubscribe(id) {
|
|
4986
|
-
let index = this.callbacks.findIndex(x => x._id == id);
|
|
4987
|
-
if (index > -1) {
|
|
4988
|
-
this.callbacks.splice(index, 1);
|
|
4989
|
-
}
|
|
4990
|
-
}
|
|
4991
|
-
/**
|
|
4992
|
-
* Triggers this event with optional data.
|
|
4993
|
-
* This will call all subscribed callbacks.
|
|
4994
|
-
* @param data
|
|
4995
|
-
*/
|
|
4996
|
-
Trigger(data) {
|
|
4997
|
-
let callbacks = this.callbacks;
|
|
4998
|
-
for (let i = 0; i < callbacks.length; i++) {
|
|
4999
|
-
let callback = callbacks[i];
|
|
5000
|
-
if (callback.callback) {
|
|
5001
|
-
callback.callback(data);
|
|
5002
|
-
}
|
|
5003
|
-
}
|
|
5004
|
-
}
|
|
5005
|
-
/**
|
|
5006
|
-
* Clears all subscriptions.
|
|
5007
|
-
*/
|
|
5008
|
-
Clear() {
|
|
5009
|
-
this.callbacks = [];
|
|
5010
|
-
}
|
|
5011
|
-
}
|
|
5012
|
-
|
|
5013
5018
|
(function (Camera) {
|
|
5014
5019
|
let EFrustum;
|
|
5015
5020
|
(function (EFrustum) {
|
|
@@ -13860,7 +13865,7 @@
|
|
|
13860
13865
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
13861
13866
|
|
|
13862
13867
|
// This is updated with the package.json version on build.
|
|
13863
|
-
const VERSION = "4.7.
|
|
13868
|
+
const VERSION = "4.7.9";
|
|
13864
13869
|
|
|
13865
13870
|
exports.VERSION = VERSION;
|
|
13866
13871
|
exports.AbstractApi = AbstractApi;
|