Skip to content

Instantly share code, notes, and snippets.

@oa495
Forked from thousand/components.splat-after\.js
Last active December 4, 2020 15:36
Show Gist options
  • Save oa495/d0b53b93965c62a04df9cc9eeb1833ec to your computer and use it in GitHub Desktop.
Save oa495/d0b53b93965c62a04df9cc9eeb1833ec to your computer and use it in GitHub Desktop.
Splat Order Demo
import Component from '@glimmer/component';
import { action } from '@ember/object';
export default class extends Component {
@action
doX() {
console.log('x');
}
}
import Component from '@glimmer/component';
import { action } from '@ember/object';
export default class extends Component {
@action
doX() {
console.log('x');
}
}
import Controller from '@ember/controller';
import { action } from '@ember/object';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
@action
doY() {
console.log('Y');
}
}
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
[aria-label] {
margin: 1rem;
}
[aria-label]:after {
display: block;
color: fuchsia;
padding-left: 2em;
content: attr(aria-label);
}
<SplatBefore aria-label="splats are cool" onclick="doY">
I'm using "SplatBefore" and setting aria-label="splats are cool"
</SplatBefore>
<SplatAfter aria-label="splats are rad" onclick="doY">
I'm using "SplatAfter" and setting aria-label="splats are rad"
</SplatAfter>
<button aria-label="splats after" {{on 'click' this.doX}} ...attributes>
{{yield}}
</button>
<button ...attributes {{on 'click' this.doX}} aria-label="splats before">
{{yield}}
</button>
{
"version": "0.17.1",
"EmberENV": {
"FEATURES": {},
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": false,
"_APPLICATION_TEMPLATE_WRAPPER": true,
"_JQUERY_INTEGRATION": true
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js",
"ember": "3.18.1",
"ember-template-compiler": "3.18.1",
"ember-testing": "3.18.1"
},
"addons": {
"@glimmer/component": "1.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment