ember-cli

Why the ember-cli is so slow

本秂侑毒 提交于 2019-12-03 13:59:22
I migrated my grunt project to ember-cli, I found the time from file modification to liveload completion was so long, about 10 minutes. After I installed ember-cli-windows, ember-cli-windows-addon, no obvious prompt was gained. The following is one example output after ember-cli-windows, ember-cli-windows-addon installed: file changed routes\services.js Build successful - 382781ms. Slowest Trees | Total ----------------------------------------------+--------------------- Babel | 82175ms Concat: Vendor | 75980ms Funnel: App JS Files | 57393ms JSHint app- QUnit | 49491ms ES6: App Tree | 41827ms

Promise based property Ember

白昼怎懂夜的黑 提交于 2019-12-03 13:19:17
I've got a controller that has a searchQuery and suggestions property. The suggestions come from an AJAX request. How can I make the suggestions property a promise in my Controller? app/controllers/application.js import Ember from 'ember'; const { computed, $ } = Ember; export default Ember.Controller.extend({ searchQuery: '', suggestions: computed('searchQuery', function() { return $.getJSON(`songs/search.json?q=${this.get('searchQuery')}`); }) }); I assume you mean, how can I get the results from the promise, since you are returning a promise to the suggestions property. searchQuery: '',

Why ember-cli uses extend instead of create?

这一生的挚爱 提交于 2019-12-03 13:18:10
In a new ember App you write first: var App = Ember.Application.create({ test: 'foo', ... }); In a new ember-cli App you write first: var App = Ember.Application.extend({ test: 'foo', ... }); Why? ( In the second case, I can't read a global property (App.test) from a controller. !? ) This question actually has a lot to do with Ember.Object . .extend() creates a new class that extends the old one, with class-level properties defined in the hash that is passed in. .create() create a new instance of the class, with object-level properties defined in the hash that is passed in. This is why you

Ember CLI with Multiple Proxies

拥有回忆 提交于 2019-12-03 12:56:04
The Problem: I have an Ember CLI Application that will consume multiple APIs, which I need to proxy to in development mode. Background: I have a legacy api which exposes services at /api running on my local development machine at localhost:3000 I have a new api which exposes services at /myapp/api/v1 . These services were recently extracted from the legacy app, and comprises the majority of the application services used by the ember app. The ember app uses the baseURL of /myapp , as it is being deployed to a subdirectory. I generated two http-proxys using ember generate http-proxy . They are

ember-cli adding dependencies with bower

假如想象 提交于 2019-12-03 12:51:24
So - I want to have a play with typeahead in an ember app. I get a cli app up and running then I run bower install typeahead.js I can see that the code has been put into bower_components. I then add the following to the brocfile: /* global require, module */ var EmberApp = require('ember-cli/lib/broccoli/ember-app'); var app = new EmberApp(); // Use `app.import` to add additional libraries to the generated // output files. // // If you need to use different assets in different // environments, specify an object as the first parameter. That // object's keys should be the environment name and

Uncaught Error: Assertion Failed: calling set on destroyed object

孤者浪人 提交于 2019-12-03 10:30:04
问题 working in ember-cli testing. After all tests passed it returns extra two test with errors. Uncaught Error: Assertion Failed: calling set on destroyed object Source : '../dist/assets/vendor.js:13269' this is one unit test configuration import Ember from "ember"; import { test,moduleFor } from 'ember-qunit'; import startApp from '../helpers/start-app'; var App; module('An Integration test',{ setup:function(){ App=startApp(); }, teardown: function() { Ember.run(App, 'destroy'); } }); 回答1: This

Using ENV values in ember-cli app during build

匆匆过客 提交于 2019-12-03 10:20:13
问题 I would like to set my RESTAdapter host based on the build environment. I assume the value can be stored in config/environment.js like this: if (environment === 'development') { ENV.API_ENDPOINT = 'http://localhost:8080'; } if (environment === 'production') { ENV.API_ENDPOINT = 'http://api.myserver.com'; } But I am unsure how to insert the information into adapter/application.js during the build process. 回答1: You define the setting like this in your config/environment.js : // snip APP: { //

How is Sorting achieved in an Ember model without using Array Controller?

旧时模样 提交于 2019-12-03 10:19:56
问题 Every google result is about an ArrayController sorting. Need a sorting mechanism without using ArrayController. There is a model where there are sort params. Like say 'sortOrder' as one of the properties in the model (which will be from a back end). Will be rendering this model using #each but this should do the iteration based on the sortOrder property and not the model's ID property. 回答1: In Ember 2.0 SortableMixin is deprecated and is on its way out too. In the Controller (not the

How to use a custom authorizer and custom authenticator for ember simple-auth in ember cli

情到浓时终转凉″ 提交于 2019-12-03 08:08:48
I don't understand how I'm supposed to include my custom authenticator and custom authorizor with ember cli. Where to put it and what to include and how to do it. The cli example for simple-auth provided unfortunately does not cover custom authorizer and authenticator. The build is successfully, but when running it in the browser, I get the error TypeError: SimpleAuth.Authenticators is undefined I'm aware that I'm doing something wrong, but could you please guide me or point me to the right documentation on how to do this, I can't find anything :( My initializer looks like this: import Ember

How to debug slow Ember CLI/Broccoli builds

孤街醉人 提交于 2019-12-03 05:55:35
My Ember CLI project is currently taking 8-9 seconds to build, and I'd like to understand why. The project is not that large (~180 files under app/ including hbs and scss). Here's my brocfile: https://gist.github.com/samselikoff/874c90758bb2ce0bb210 However, even if I comment my entire Brocfile out and export just the app variable, the build still takes 5-6 seconds. I'm not quite sure how debug. Here's my slowest tree logs: Build successful - 8874ms. Slowest Trees | Total -------------------------------+---------------- TreeMerger (appAndDependencies)| 1286ms TreeMerger (vendor) | 1275ms