Skip to content

Instantly share code, notes, and snippets.

@sirreal
Last active January 25, 2024 14:49
Show Gist options
  • Save sirreal/7b9f1004b88e97c7bd6f822fcf53c2fc to your computer and use it in GitHub Desktop.
Save sirreal/7b9f1004b88e97c7bd6f822fcf53c2fc to your computer and use it in GitHub Desktop.
Test PR 58258
<body>
<div
data-wp-interactive='{"namespace":"jon/the-block"}'
data-wp-context='{"val":0}'
>
<input
readonly
type="number"
class="jon-val"
data-wp-bind--value="context.val"
value="0"
/>
<button class="jon-inc" data-wp-on--click="actions.inc">+</button>
<button class="jon-dec" data-wp-on--click="actions.dec">&#8211;</button>
</div>
<div
data-wp-interactive='{"namespace":"jon/the-block"}'
data-wp-context='{"val":0}'
>
<input
readonly
type="number"
class="jon-val"
data-wp-bind--value="context.val"
value="0"
/>
<button class="jon-inc" data-wp-on--click="actions.inc">+</button>
<button class="jon-dec" data-wp-on--click="actions.dec">&#8211;</button>
</div>
<script src="dist/main.js"></script>
</body>
import * as interactivity from "jons-test-wp-interactivity";
console.log("running");
interactivity.store("jon/the-block", {
actions: {
inc() {
console.log("inc");
interactivity.getContext().val += 1;
},
dec() {
console.log("dec");
interactivity.getContext().val -= 1;
},
},
});
{
"name": "test-interactivity-package",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"jons-test-wp-interactivity": "^0.0.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment