Skip to content

Instantly share code, notes, and snippets.

@MaximBalaganskiy
Last active May 11, 2023 11:20
Show Gist options
  • Save MaximBalaganskiy/511fc27fe6bc33ec97acf0607b2525a8 to your computer and use it in GitHub Desktop.
Save MaximBalaganskiy/511fc27fe6bc33ec97acf0607b2525a8 to your computer and use it in GitHub Desktop.
typed-plugin-bug
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Dumber Gist</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<base href="/">
</head>
<!--
Dumber gist uses dumber bundler, the default bundle file
is /dist/entry-bundle.js.
The starting module is pointed to aurelia-bootstrapper
(data-main attribute on script) for Aurelia,
The aurelia bootstrapper then loads up user module "main"
(aurelia-app attribute on <body>) which is your src/main.ts.
-->
<body aurelia-app="main">
<script src="/dist/entry-bundle.js" data-main="aurelia-bootstrapper"></script>
</body>
</html>
{
"dependencies": {
"aurelia-bootstrapper": "latest",
"aurelia-typed-observable-plugin": "latest"
}
}
<template>
<require from="./my-attr"></require>
<require from="./my-elem"></require>
<!-- Try to create a css/scss/sass/less file then require it here -->
<h1 my-attr="text.bind: 'text'; textNone.bind: 'textNone'">Click me!</h1>
<my-elem text-none="textNone"></my-elem>
</template>
export class App {
public message: string = 'Hello Aurelia!';
}
import {Aurelia} from 'aurelia-framework';
import { coerceFunctions, createTypedBindable } from 'aurelia-typed-observable-plugin';
coerceFunctions.none = function (a) {
return a;
}
createTypedBindable('none');
export function configure(aurelia: Aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging('info');
aurelia.start().then(() => aurelia.setRoot());
}
import { bindable } from 'aurelia-typed-observable-plugin';
import { customAttribute } from 'aurelia-templating';
@customAttribute('my-attr')
export class MyAttr{
constructor(private element: Element) {
}
@bindable.none
textNone: string;
@bindable
text: string;
attached(){
this.element.addEventListener('click', () => alert(`Text: ${this.text}, TextNone: ${this.textNone}`));
}
}
<template>${textNone}</template>
import { bindable } from 'aurelia-typed-observable-plugin';
export class MyElem {
@bindable.none
textNone: string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment