Skip to content

Instantly share code, notes, and snippets.

import { css, component, Element } from 'nativeweb';
const styles = css`
h1 {
color: orange;
}
`;
@component('some-styles', styles)
export class SomeStyles extends Element {
import { component, customEvent, Element } from 'nativeweb';
@component('first-component')
export class FirstComponent extends Element {
@event() ready = {
'other-component': this.onReady()
};
onReady({ detail }) {
console.log(detail);
import { component, event, Element } from 'nativeweb';
@component('simple-event')
export class SimpleEvent extends Element {
@event() click = {
'@button': this.onClick()
};
onClick() {
console.log('👆');
@hum-n
hum-n / return_loop.js
Created October 17, 2020 17:21
Return JavaScript array loop.
return arr.map(item => item);
@hum-n
hum-n / array_loop.js
Created October 17, 2020 16:38
JavaScript array loop.
arr.forEach(item => {
console.log(item);
});
@hum-n
hum-n / values_loop.js
Created October 17, 2020 16:31
Values JavaScript object loop.
Object.values(obj).forEach(val => {
console.log(val);
});
@hum-n
hum-n / keys_loop.js
Created October 17, 2020 16:28
Keys JavaScript object loop.
Object.keys(obj).forEach(key => {
console.log(key);
console.log(obj[key]); // value
});
@hum-n
hum-n / keys-values_loop.js
Last active October 17, 2020 16:25
Keys and values JavaScript object loop.
Object.entries(obj).forEach(([key, val]) => {
console.log(key);
console.log(val);
});
const styles = {
black: '\x1b[30m',
red: '\x1b[31m',
green: '\x1b[32m',
yellow: '\x1b[33m',
blue: '\x1b[34m',
magenta: '\x1b[35m',
cyan: '\x1b[36m',
white: '\x1b[37m',
function install(dest) {
run('npm', ['install', '--prefix', dest]);
}