plusui-native-core 0.1.53 → 0.1.54
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/Core/Features/Connection/ARCHITECTURE.md +1 -1
- package/Core/Features/Connection/README.md +3 -3
- package/Core/Features/Connection/{connection.cpp → connect.cpp} +6 -6
- package/Core/Features/Connection/examples/simple_tags_example.hpp +2 -2
- package/Core/generated/bridge.hpp +2 -2
- package/Core/include/plusui/{connection.hpp → connect.hpp} +6 -5
- package/Core/include/plusui/plusui.hpp +1 -1
- package/package.json +1 -1
- /package/Core/Features/Connection/{connection.ts → connect.ts} +0 -0
|
@@ -217,7 +217,7 @@ Frontend Backend
|
|
|
217
217
|
│ uses
|
|
218
218
|
▼
|
|
219
219
|
┌──────────────────────────────────────┐
|
|
220
|
-
│ Core
|
|
220
|
+
│ Core Connect (connect.hpp) │
|
|
221
221
|
│ ┌────────────────────────────────┐ │
|
|
222
222
|
│ │ class Connection { │ │
|
|
223
223
|
│ │ void send(Envelope) │ │
|
|
@@ -30,7 +30,7 @@ Just `emit()` and `on()` handle all communication patterns:
|
|
|
30
30
|
### Send Message →
|
|
31
31
|
|
|
32
32
|
```typescript
|
|
33
|
-
import { connect } from 'plusui-native-core/
|
|
33
|
+
import { connect } from 'plusui-native-core/connect';
|
|
34
34
|
|
|
35
35
|
// Listen for response
|
|
36
36
|
connect.on('greetResponse', (data) => {
|
|
@@ -44,9 +44,9 @@ connect.emit('greet', { name: 'World' });
|
|
|
44
44
|
### Receive & Respond
|
|
45
45
|
|
|
46
46
|
```cpp
|
|
47
|
-
#include <plusui/
|
|
47
|
+
#include <plusui/connect.hpp>
|
|
48
48
|
|
|
49
|
-
class
|
|
49
|
+
class MyConnect : public plusui::Connect {
|
|
50
50
|
protected:
|
|
51
51
|
void handleMessage(const Envelope& env) override {
|
|
52
52
|
// Listen for messages from frontend
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
#include <plusui/
|
|
1
|
+
#include <plusui/connect.hpp>
|
|
2
2
|
|
|
3
3
|
namespace plusui {
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// Connect implementation
|
|
6
6
|
//
|
|
7
|
-
// The
|
|
7
|
+
// The Connect class is header-only (see plusui/connect.hpp).
|
|
8
8
|
// This file is reserved for future non-template implementation details.
|
|
9
9
|
//
|
|
10
10
|
// TWO METHODS. FIVE PRIMITIVES. EVERYTHING YOU NEED.
|
|
11
11
|
//
|
|
12
|
-
// To use
|
|
13
|
-
// 1. Create a class that inherits from plusui::
|
|
12
|
+
// To use Connect:
|
|
13
|
+
// 1. Create a class that inherits from plusui::Connect
|
|
14
14
|
// 2. Override handleMessage(name, payload) to receive messages
|
|
15
15
|
// 3. Use emit(name, payload) to send messages to frontend
|
|
16
16
|
//
|
|
17
17
|
// Example - All 5 Primitives:
|
|
18
18
|
//
|
|
19
|
-
// class MyApp : public plusui::
|
|
19
|
+
// class MyApp : public plusui::Connect {
|
|
20
20
|
// protected:
|
|
21
21
|
// void handleMessage(const std::string& name, const nlohmann::json& data) override {
|
|
22
22
|
// // EVENT: fire & forget
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
#pragma once
|
|
8
|
-
#include <plusui/
|
|
8
|
+
#include <plusui/connect.hpp>
|
|
9
9
|
#include <string>
|
|
10
10
|
|
|
11
11
|
namespace example {
|
|
12
12
|
|
|
13
|
-
class SimpleApp : public plusui::
|
|
13
|
+
class SimpleApp : public plusui::Connect {
|
|
14
14
|
public:
|
|
15
15
|
|
|
16
16
|
// ============================================
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-generated by plusui-bindgen
|
|
3
3
|
* DO NOT EDIT - Changes will be overwritten
|
|
4
|
-
* Generated from:
|
|
4
|
+
* Generated from: connect.schema
|
|
5
5
|
*/
|
|
6
6
|
#pragma once
|
|
7
|
-
#include <plusui/
|
|
7
|
+
#include <plusui/connect.hpp>
|
|
8
8
|
#include <string>
|
|
9
9
|
#include <vector>
|
|
10
10
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
#include <string>
|
|
6
6
|
|
|
7
7
|
// ============================================
|
|
8
|
-
// PlusUI
|
|
8
|
+
// PlusUI Connect Feature
|
|
9
9
|
// ============================================
|
|
10
10
|
//
|
|
11
11
|
// TWO METHODS. FIVE PRIMITIVES. EVERYTHING YOU NEED.
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
// BASIC USAGE
|
|
47
47
|
// ============================================
|
|
48
48
|
//
|
|
49
|
-
// class
|
|
49
|
+
// class MyConnect : public plusui::Connect {
|
|
50
50
|
// protected:
|
|
51
51
|
// void handleMessage(const std::string& name, const nlohmann::json& data) override {
|
|
52
52
|
// if (name == "greet") {
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
|
|
61
61
|
namespace plusui {
|
|
62
62
|
|
|
63
|
-
class
|
|
63
|
+
class Connect {
|
|
64
64
|
std::function<void(const std::string &)> outboundHandler;
|
|
65
65
|
|
|
66
66
|
public:
|
|
67
|
-
virtual ~
|
|
67
|
+
virtual ~Connect() = default;
|
|
68
68
|
|
|
69
69
|
// Setup the outbound message handler
|
|
70
70
|
void setOutbound(std::function<void(const std::string &)> h) {
|
|
@@ -140,6 +140,7 @@ protected:
|
|
|
140
140
|
};
|
|
141
141
|
|
|
142
142
|
// Legacy alias for backwards compatibility
|
|
143
|
-
using Bridge =
|
|
143
|
+
using Bridge = Connect;
|
|
144
|
+
using Connection = Connect;
|
|
144
145
|
|
|
145
146
|
} // namespace plusui
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
#include <plusui/app.hpp>
|
|
26
26
|
#include <plusui/browser.hpp>
|
|
27
27
|
#include <plusui/clipboard.hpp>
|
|
28
|
-
#include <plusui/
|
|
28
|
+
#include <plusui/connect.hpp>
|
|
29
29
|
#include <plusui/display.hpp>
|
|
30
30
|
#include <plusui/filedrop.hpp>
|
|
31
31
|
#include <plusui/keyboard.hpp>
|
package/package.json
CHANGED
|
File without changes
|