This file contains hidden or 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 Controller from '@ember/controller'; | |
import { inject as service } from '@ember/service'; | |
export default class ApplicationController extends Controller { | |
appName = 'Ember Twiddle'; | |
transitionToQp = () => { | |
this.router.transitionTo({ queryParams: { foo: 123 } }); | |
} | |
This file contains hidden or 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
class FetchTask { | |
@tracked isLoading = true; | |
@tracked result; | |
constructor(url) { | |
this.run(url); | |
} | |
async run(url) { | |
let response = await fetch(url); |
This file contains hidden or 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 from '@glimmer/component'; | |
import { action } from '@ember/object'; | |
import { tracked } from '@glimmer/tracking'; | |
export default class extends Component { | |
@tracked showDD = false; | |
@tracked selectedFilters = []; | |
get unselectedFilters() { | |
return this.args.options.filter(f => !this.selectedFilters.includes(f)); |
This file contains hidden or 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
## Earth and Moon | |
Terra | |
Gaia | |
Luna | |
## Planets | |
Mercury | |
Venus |
This file contains hidden or 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 { createTag, dirtyTag, consumeTag } from '@glimmer/tracking/tags'; | |
export function inLocalStorage( | |
target, | |
propertyKey, | |
descriptor | |
) { | |
const targetName = target.constructor.name; | |
const key = `${targetName}-${propertyKey}`; |
This file contains hidden or 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 { get, notifyPropertyChange } from '@ember/object'; | |
export function inLocalStorage( | |
target, | |
propertyKey, | |
descriptor | |
) { | |
const targetName = target.constructor.name; | |
const { initializer } = descriptor; |
This file contains hidden or 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 { TrackedWeakMap } from 'tracked-built-ins'; | |
function localCopy(target, key) { | |
let values = new TrackedWeakMap(); | |
let lastValues = new WeakMap(); | |
return { | |
get() { | |
let incoming = this.args[key]; | |
let lastValue = lastValues.get(this); |
This file contains hidden or 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
let innerWidthDesc = Object.getOwnPropertyDescriptor(window, 'innerWidth'); | |
let getOriginalInnerWidth = innerWidthDesc.get.bind(window); | |
let setOriginalInnerWidth = innerWidthDesc.set.bind(window); | |
let VERTICAL_TABS_ENABLED = false; | |
Object.defineProperty(window, 'innerWidth', { | |
get() { | |
if (VERTICAL_TABS_ENABLED) { | |
return getOriginalInnerWidth() - 200; |
This file contains hidden or 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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
queryParams: ['foo'], | |
foo: 'bar', | |
actions: { |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>es6 proxy #jsbench #jsperf</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |