Skip to content

Instantly share code, notes, and snippets.

View vbkmr's full-sized avatar

vb vbkmr

View GitHub Profile
>main.js //to be invoked onLoad()
const store_ = new Store();
...
>store.js
constructor(){
this.state_ = {};
this.stateSubscriber_ = [];
}
{
"basics": {
"name": "Vaibhav Kumar",
"label": "Web Developer",
"summary": "I’m a full stack web developer who loves working with open source technology. I work best at planning the architecture of web applications and their development life cycles. I also love to get the community involved and have had much experience with building and organizing large open source groups. Specialties: React, Redux, Javascript - Full stack developer with lots of experience in lots of stuff.",
"website": "https://vaibhavkumar.me",
"email": "vaibhav.iiitj@gmail.com",
"location": {
"city": "Tokyo",
"countryCode": "JP"
customElements.define( // registering our custom-element to CustomElementRegistry
"fancy-af-button",
class extends HTMLElement { // defining our custom-element
constructor() {
// always call super() first in the constructor.
super();
// reading custom-element's template
const template = document.getElementById("fancy-af-button-template");
const templateContent = template.content;
<template id="fancy-af-button-template">
<button>
<slot />
<!-- placeholder inside a WC to be replaced by markups attached at run-time -->
</button>
</template>
<fancy-af-button>
<span>I'm fancy!</span> <!-- will replace <slot /> -->
</fancy-af-button>
import { r as registerInstance, h } from './core-957b5e39.js';
const FancyAFButton = class {
constructor(hostRef) {
registerInstance(this, hostRef);
this.clickedCount = 0;
}
handleClick() {
this.clickedCount += 1;
}
import { Component, Prop, h, Listen, State } from "@stencil/core";
@Component({
tag: "fancy-af-button",
styleUrl: "fancy-af-button.css",
shadow: true
})
export class FancyAFButton {
@State() clickedCount: number = 0;
(module
(table 0 anyfunc)
(memory $0 1)
(export "memory" (memory $0))
(export "factorial" (func $factorial))
(func $factorial (; 0 ;) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(set_local $2
(i32.const 1)
(module
(table 0 anyfunc)
(memory $0 1)
(export "memory" (memory $0))
(export "squareMe" (func $squareMe))
(func $squareMe (; 0 ;) (param $0 i32) (result i32)
(i32.mul
(get_local $0)
(get_local $0)
)
int squareMe (int n) {
return n * n;
}
int factorial(int n)
{
if(n > 1)
return n * factorial(n - 1);
else
return 1;
}