Skip to content

Instantly share code, notes, and snippets.

View template.json
[
["open-element", "h1", []],
["text", "Hello World"],
["close-element"]
]
View resolver.ts
resolve<U>(handle: number): U {
return this.table[handle];
}
View external-module-table.js
import UserProfile from './src/ui/components/UserProfile/component';
/* ...other component imports */
export let table = [
/* Component1 */,
/* Component2 */,
/* ... */,
/* Component41 */,
UserProfile,
/* Component43 */,
@tomdale
tomdale / bytecode.ts
Created Oct 20, 2017
Glimmer.js Application proposal
View bytecode.ts
// This is the API for constructing a Glimmer.js application with
// precompiled binary bytecode templates and using an async renderer
// (via requestAnimationFrame, requestIdleCallback, etc).
import Application, { DOMBuilder, AsyncRenderer, BytecodeLoader } from '@glimmer/application';
import data from './__compiled__/data';
let bytecode = fetch('./__compiled__/templates.gbx')
.then(req => req.arrayBuffer());
@tomdale
tomdale / ember-cli-build.js
Created Oct 13, 2017
Disable packaging with Rollup in Glimmer.js and build JS modules
View ember-cli-build.js
'use strict';
const GlimmerApp = require('@glimmer/application-pipeline').GlimmerApp;
class ModuleApp extends GlimmerApp {
package(tree) {
return tree;
}
}
View samsung-galaxy-s3-slow-3g.json
This file has been truncated, but you can view the full file.
[{"pid":10425,"tid":10444,"ts":1844493621,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../gpu/ipc/service/gpu_watchdog_thread.cc","src_func":"OnAcknowledge"},"dur":152,"tdur":153,"tts":77094},
{"pid":10425,"tid":10444,"ts":1844494048,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../gpu/ipc/service/gpu_watchdog_thread.cc","src_func":"CheckArmed"},"dur":31,"tdur":30,"tts":77308},
{"pid":10425,"tid":10444,"ts":1849494170,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../gpu/ipc/service/gpu_watchdog_thread.cc","src_func":"OnAcknowledge"},"dur":61,"tdur":61,"tts":77430},
{"pid":10425,"tid":10444,"ts":1849550511,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../gpu/ipc/service/gpu_watchdog_thread.cc","src_func":"CheckArmed"},"dur":30,"tdur":30,"tts":77613},
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Array Check vs. String Check</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>
View glimmer-compiler-api-sketch.ts
// PDI lazy evaluation of webpack modules
// 1. during compile time, answering what is in scope
// 1a. if it is in scope, what is the fully qualified path?
// 2. compilation handle + metadata
// 3. please map this handle to a ComponentSpec (manager + definition)
// 4. please resolve (component name, referrer) into handle (for dynamic component helper)
// return wire format as metadata for compile step
// need to add hasComponentHelper
View ember-cli-build.js
const babel = require('broccoli-babel-transpiler');
const uglify = require('broccoli-uglify-js');
let jsTree = funnel('src', { include: ['**/*.js'] })
.apply(babel, { presets: ['env'] })
.apply(uglify);
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});