@player-devtools/plugin 0.16.1-next.2 → 1.0.0--canary.38.1480
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/DevtoolsPlugin.native.js +39 -0
- package/dist/DevtoolsPlugin.native.js.map +1 -1
- package/dist/cjs/index.cjs +33 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.legacy-esm.js +33 -0
- package/dist/index.mjs +33 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/__tests__/plugin.test.ts +81 -0
- package/src/helpers/getNowTime.ts +1 -1
- package/src/plugin.ts +31 -0
- package/src/reducer.ts +10 -0
- package/types/plugin.d.ts +8 -0
|
@@ -1107,6 +1107,14 @@ var DevtoolsPlugin = function() {
|
|
|
1107
1107
|
};
|
|
1108
1108
|
draft.messages.push(message);
|
|
1109
1109
|
});
|
|
1110
|
+
case "PLAYER_DEVTOOLS_PLAYER_STOPPED":
|
|
1111
|
+
return produce(state, function(draft) {
|
|
1112
|
+
var message = {
|
|
1113
|
+
type: "PLAYER_DEVTOOLS_PLAYER_STOPPED",
|
|
1114
|
+
payload: transaction.payload
|
|
1115
|
+
};
|
|
1116
|
+
draft.messages.push(message);
|
|
1117
|
+
});
|
|
1110
1118
|
case "PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE":
|
|
1111
1119
|
return produce(state, function(draft) {
|
|
1112
1120
|
var payload = transaction.payload;
|
|
@@ -1193,6 +1201,7 @@ var DevtoolsPlugin = function() {
|
|
|
1193
1201
|
this.options = options;
|
|
1194
1202
|
this.name = "DevtoolsPlugin";
|
|
1195
1203
|
this.loggedWarning = false;
|
|
1204
|
+
/** True once devtools has been told about this player */ this.announced = false;
|
|
1196
1205
|
this.store = useStateReducer(reducer, INITIAL_STATE);
|
|
1197
1206
|
this.lastProcessedInteraction = 0;
|
|
1198
1207
|
this.store.subscribe(function(param) {
|
|
@@ -1269,6 +1278,25 @@ var DevtoolsPlugin = function() {
|
|
|
1269
1278
|
_messenger_: true
|
|
1270
1279
|
};
|
|
1271
1280
|
this.store.dispatch(transaction);
|
|
1281
|
+
this.announced = true;
|
|
1282
|
+
}
|
|
1283
|
+
},
|
|
1284
|
+
{
|
|
1285
|
+
key: "dispatchPlayerStopped",
|
|
1286
|
+
value: function dispatchPlayerStopped() {
|
|
1287
|
+
var transaction = {
|
|
1288
|
+
id: -1,
|
|
1289
|
+
type: "PLAYER_DEVTOOLS_PLAYER_STOPPED",
|
|
1290
|
+
payload: {
|
|
1291
|
+
pluginID: this.pluginID
|
|
1292
|
+
},
|
|
1293
|
+
sender: this.options.playerID,
|
|
1294
|
+
context: "player",
|
|
1295
|
+
target: "player",
|
|
1296
|
+
timestamp: Date.now(),
|
|
1297
|
+
_messenger_: true
|
|
1298
|
+
};
|
|
1299
|
+
this.store.dispatch(transaction);
|
|
1272
1300
|
}
|
|
1273
1301
|
},
|
|
1274
1302
|
{
|
|
@@ -1345,6 +1373,17 @@ var DevtoolsPlugin = function() {
|
|
|
1345
1373
|
if (!this.checkIfDevtoolsIsActive()) return;
|
|
1346
1374
|
this.dispatchPlayerInit();
|
|
1347
1375
|
}
|
|
1376
|
+
},
|
|
1377
|
+
{
|
|
1378
|
+
/**
|
|
1379
|
+
* Tell devtools this plugin is gone. Call it before the messenger is destroyed.
|
|
1380
|
+
* Safe to call more than once.
|
|
1381
|
+
*/ key: "teardown",
|
|
1382
|
+
value: function teardown() {
|
|
1383
|
+
if (!this.announced) return;
|
|
1384
|
+
this.announced = false;
|
|
1385
|
+
this.dispatchPlayerStopped();
|
|
1386
|
+
}
|
|
1348
1387
|
}
|
|
1349
1388
|
]);
|
|
1350
1389
|
return DevtoolsPlugin;
|