This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { css, component, Element } from 'nativeweb'; | |
const styles = css` | |
h1 { | |
color: orange; | |
} | |
`; | |
@component('some-styles', styles) | |
export class SomeStyles extends Element { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { component, event, Element } from 'nativeweb'; | |
@component('simple-event') | |
export class SimpleEvent extends Element { | |
@event() click = { | |
'@button': this.onClick() | |
}; | |
onClick() { | |
console.log('👆'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return arr.map(item => item); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arr.forEach(item => { | |
console.log(item); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.values(obj).forEach(val => { | |
console.log(val); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.keys(obj).forEach(key => { | |
console.log(key); | |
console.log(obj[key]); // value | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.entries(obj).forEach(([key, val]) => { | |
console.log(key); | |
console.log(val); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function install(dest) { | |
run('npm', ['install', '--prefix', dest]); | |
} |
NewerOlder