Skip to content

Instantly share code, notes, and snippets.

@asakusuma
Created January 16, 2020 18:36
Show Gist options
  • Save asakusuma/7dd582096ec3e1adc751a813be123197 to your computer and use it in GitHub Desktop.
Save asakusuma/7dd582096ec3e1adc751a813be123197 to your computer and use it in GitHub Desktop.
Custom History Test
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import HistoryLocation from '@ember/routing/history-location';
// https://api.emberjs.com/ember/release/classes/Location
console.log("eval history file");
export default class MyHistory {
implementation = 'my-custom-history';
constructor() {
this._history = HistoryLocation.create(...arguments);
console.log("create history class");
}
create() {
return new this(...arguments);
}
pushState(path) {
console.log("push state");
this._history.pushState(path);
}
}
import EmberRouter from '@ember/routing/router';
import config from './config/environment';
const Router = EmberRouter.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route("foo");
});
export default Router;
<h1>Welcome to {{appName}}</h1>
<br>
{{#link-to "foo"}}foo{{/link-to}}
{{#link-to "index"}}home{{/link-to}}
<br>
{{outlet}}
<br>
<br>
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment