@microsoft/applicationinsights-offlinechannel-js 0.1.1-nightly3.2403-02 → 0.1.1-nightly3.2403-03

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/README.md CHANGED
@@ -44,6 +44,45 @@ The Offline Channel supports the saving of events when your application is offli
44
44
  | httpXHROverride | [Optional] | null | The HTTP override that should be used to send requests, as an `IXHROverride` object. |
45
45
  | alwaysUseXhrOverride | [Optional] | false | Identifies if provided httpXhrOverride will always be used. |
46
46
 
47
+ ## Basic Usage
48
+
49
+ ### NPM Setup
50
+
51
+ ```js
52
+ import { OfflineChannel, eStorageProviders } from "@microsoft/applicationinsights-offlinechannel-js";
53
+
54
+ let offlineChannel = new OfflineChannel();
55
+ let coreConfig = {
56
+ connectionString: "YOUR_CONNECTION_STRING",
57
+ extensionConfig: {
58
+ [offlineChannel.identifier]: {
59
+ providers: [eStorageProviders.LocalStorage, eStorageProviders.IndexedDb],
60
+ minPersistenceLevel: 2, // only events with PersistenceLevel >=2 will be saved/sent
61
+ } // Add config for offline support channel
62
+ }
63
+ };
64
+ let appInsights = new ApplicationInsights({config: coreConfig});
65
+ appInsights.loadAppInsights();
66
+ // this is to make sure offline channel is initialized after sender channel
67
+ appInsights.addPlugin(offlineChannel);
68
+
69
+ // get offlineListener to set online/offline status
70
+ let offlineListener = offlineChannel.getOfflineListener();
71
+
72
+
73
+ // set application status to online
74
+ offlineListener.setOnlineState(1);
75
+ // offline channel will not process events when the status is online
76
+ appInsights.track({ name:"onlineEvent" }); // sender channel will send this event
77
+
78
+ // set application status to offline
79
+ offlineListener.setOnlineState(2);
80
+ // offline channel will process and save this event to the configured persistent storage
81
+ // the event will be sent when the application status is online again
82
+ appInsights.track({ name:"offlineEvent" });
83
+
84
+ ```
85
+
47
86
  ## Contributing
48
87
 
49
88
  Read our [contributing guide](./CONTRIBUTING.md) to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Application Insights.
@@ -52,11 +91,11 @@ Read our [contributing guide](./CONTRIBUTING.md) to learn about our development
52
91
 
53
92
  As this SDK is designed to enable applications to perform data collection which is sent to the Microsoft collection endpoints the following is required to identify our privacy statement.
54
93
 
55
- The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsofts privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
94
+ The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
56
95
 
57
96
  ## Trademarks
58
97
 
59
- This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsofts Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-partys policies.
98
+ This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.
60
99
 
61
100
  ## License
62
101
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Offline Channel, 0.1.1-nightly3.2403-02
2
+ * Application Insights JavaScript SDK - Offline Channel, 0.1.1-nightly3.2403-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -6234,7 +6234,7 @@
6234
6234
  return Sender;
6235
6235
  }());
6236
6236
 
6237
- var version = '0.1.1-nightly3.2403-02';
6237
+ var version = '0.1.1-nightly3.2403-03';
6238
6238
  var DefaultOfflineIdentifier = "OfflineChannel";
6239
6239
  var DefaultBatchInterval = 15000;
6240
6240
  var DefaultInMemoMaxTime = 15000;