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'; | |
function Range(start, end) { | |
var ret = {}; | |
ret[Symbol.iterator] = function *() { | |
while (start < end) | |
yield start++; | |
} | |
return ret; | |
} |
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'; | |
const iterable1 = {}; | |
iterable1[Symbol.iterator] = function* () { | |
yield 1; | |
yield 2; | |
yield 3; | |
}; |
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'; | |
export default class ApplicationController extends Controller { | |
rows = Array(200).fill(null).map(() => Array(100).fill(null).map(x => Math.random().toString().substr(2, 4))); | |
} |
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'; | |
const wait = ms => new Promise(resolve => setTimeout(resolve, ms)); | |
export default class ApplicationController extends Controller { | |
async foo() { | |
await wait(5); | |
throw new Error("bla", { foo: 12 }); | |
} | |
} |
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 {action} from '@ember/object'; | |
export default class ApplicationController extends Controller { | |
@action | |
clickList(e) { | |
alert('clicked list'); | |
e.preventDefault(); | |
} | |
} |
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 {action} from '@ember/object'; | |
export default class ApplicationController extends Controller { | |
@action | |
clickList(e) { | |
alert('clicked list'); | |
e.preventDefault(); | |
} | |
} |
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 { | |
get value() { | |
if(!this.args.value) { | |
return ''; | |
} | |
if(Array.isArray(this.args.value) && this.args.value && this.args.value[0] === 'm') { |
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 Adapter from '@ember-data/adapter'; | |
import RSVP from 'rsvp'; | |
export default class RecordAdapter extends Adapter { | |
async findRecord() { | |
return RSVP.resolve({ | |
data: { | |
id: 'bla', | |
type: 'record', | |
"relationships" : { |
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 { set, action, computed } from '@ember/object'; | |
export default class ApplicationController extends Controller { | |
appName = 'Ember Twiddle'; | |
@action setAppName(arg) { | |
this.set('appName', arg); | |
} |
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'; | |
function arg (object, property, descriptor) { | |
return { | |
get () { | |
return descriptor.initializer(); | |
}, | |
}; | |
} |