Skip to content

Instantly share code, notes, and snippets.

🎖
Hello, New World!

KyuWoo Choi kyuwoo-choi

Block or report user

Report or block kyuwoo-choi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View making-webassembly-better-for-rust-3.rs
// Rust
#[wasm_bindgen]
pub struct Foo {
contents: u32,
}
#[wasm_bindgen]
impl Foo {
pub fn new() -> Foo {
Foo { contents: 0 }
View making-webassembly-better-for-rust-1.rs
#[wasm_bindgen]
extern {
type console;
#[wasm_bindgen(static = console)]
fn log(s: &str);
}
View webcomponents-reactway-13.js
import createStore from 'redux-zero';
const initialState = { route: '', todoList: [] };
const store = createStore(initialState);
export default store;
import store from './store';
function actionCreator(action) {
return function() {
let state = store.getState();
state = action(state, ...arguments);
store.setState(state);
View webcomponents-reactway-12.js
// todoList.js
render() {
...
const todoItems = todoList
.filter(todo => {
return (
route === '' ||
(route === 'completed' && todo.completed) ||
(route === 'active' && !todo.completed)
);
View webcomponents-reactway-11.js
render() {
const todo = this.todo;
const classCompleted = todo.completed ? ' completed' : '';
const inputToggle = todo.completed
? html`<input class="toggle" type="checkbox" checked>`
: html`<input class="toggle" type="checkbox">`;
const classEditing = this._editing ? ' editing' : '';
return html`
${style}
<div data-id$="${todo.id}" class$="${'item' +
View webcomponents-reactway-10.js
import { toggle, remove, replace } from '../libs/actions';
...
class TodoItem extends LitRender(HTMLElement) {
...
connectedCallback() {
const root = this.shadowRoot;
...
root.addEventListener('click', handlers.onClick);
...
}
View webcomponents-reactway-9.js
import { render } from '../../node_modules/lit-html/lib/lit-extended';
export default base =>
class extends base {
render() {}
async invalidate(instant) {
if (!this.needsRender) {
if (!instant) {
this.needsRender = true;
await 0;
this.needsRender = false;
View webcomponents-reactway-7.js
...
render() {
return html`
<style>
host: {
display: block;
}
section {
background: #fff;
margin: 130px 0 40px 0;
View webcomponents-reactway-6.js
...
add(title) {
add(title);
}
...
get length() {
const todoList = store.getState().todoList;
return todoList.length;
}
...
You can’t perform that action at this time.