samedi 24 décembre 2022

cordovaProj.create is not a function with Emberjs + corber

I'm trying to add corber to my existing EmberJS application. When I run corber init then I get

stack: TypeError: cordovaProj.create is not a function at Class.run (/Users/denisk/.nvm/versions/node/v18.12.1/lib/node_modules/corber/lib/targets/cordova/tasks/create-project.js:33:26) at /Users/denisk/.nvm/versions/node/v18.12.1/lib/node_modules/corber/lib/tasks/create-project.js:97:24 at tryCatcher (/Users/denisk/.nvm/versions/node/v18.12.1/lib/node_modules/corber/node_modules/rsvp/dist/rsvp.js:326:21) at invokeCallback (/Users/denisk/.nvm/versions/node/v18.12.1/lib/node_modules/corber/node_modules/rsvp/dist/rsvp.js:498:33) at publish (/Users/denisk/.nvm/versions/node/v18.12.1/lib/node_modules/corber/node_modules/rsvp/dist/rsvp.js:484:9) at flush (/Users/denisk/.nvm/versions/node/v18.12.1/lib/node_modules/corber/node_modules/rsvp/dist/rsvp.js:2441:7) at process.processTicksAndRejections (node:internal/process/task_queues:77:11)

My env is:

ember-cli: 4.9.2 node: 18.12.1

How can I add corber and build mobile app with Ember?




lundi 19 décembre 2022

How do i get the ember-concurrency ajax-throttling example to work in my dev environment?

My question is, what do i need to fix so that my implementation of the ember-concurrency Ajax Throttling example works as expected. Specifically, in my implementation no log entries are displayed (as they are on the example page), and the console.log statement that i added in the loopingAjaxTask inner function is not executed nor is the console.log statement in the task. I have copied the example nearly verbatim with the only changes being that i've added in those console.log statements.

The line 'looping Ajax task outer function' is written to the console 8 times as expected, but the 'looping Ajax task inner function' is never written to the console log. The 'Hello World' text from the component is written to the page.

I am using ember 4.8 and ember-concurrency 2.3.7.

Here's the template where i've included the AjaxThrottling component.

app/templates/example.hbs


<p>Here's where the log entries should appear</p>
<AjaxThrottling />
 

app/components/ajax-throttling.hbs

<div>
    hello world
  <ul>
    
      <li style= ></li>
    
  </ul>
</div>

and here is component's js page

import Component from '@glimmer/component';
import { enqueueTask, task, timeout } from 'ember-concurrency';

function loopingAjaxTask(id, color) {
    console.log('looping Ajax task outer function');
    return function* () {
        console.log('looping Ajax task inner function');
        while (true) {
        this.log(color, `Task ${id}: making AJAX request`);
        yield this.ajaxTask.perform();
        this.log(color, `Task ${id}: Done, sleeping.`);
        yield timeout(2000);
      }
    };
  }

export default class AjaxThrottlingComponent extends Component {

    tagName = '';
    logs = [];
  
    ajaxTask = enqueueTask({ maxConcurrency: 3 }, async () => {
      // simulate slow AJAX
      console.log('inside the task')
      await timeout(2000 + 2000 * Math.random());
      return {};
    });
  
    @task({ on: 'init' }) task0 = loopingAjaxTask(0, '#0000FF');
    @task({ on: 'init' }) task1 = loopingAjaxTask(1, '#8A2BE2');
    @task({ on: 'init' }) task2 = loopingAjaxTask(2, '#A52A2A');
    @task({ on: 'init' }) task3 = loopingAjaxTask(3, '#DC143C');
    @task({ on: 'init' }) task4 = loopingAjaxTask(4, '#20B2AA');
    @task({ on: 'init' }) task5 = loopingAjaxTask(5, '#FF1493');
    @task({ on: 'init' }) task6 = loopingAjaxTask(6, '#228B22');
    @task({ on: 'init' }) task7 = loopingAjaxTask(7, '#DAA520');
  
    log(color, message) {
      let logs = this.logs;
      logs.push({ color, message });
      this.set('logs', logs.slice(-7));
    }
}




vendredi 16 décembre 2022

Specifying a different template path for an ember component

Suppose I have this structure:

modals/
├─ index.hbs
├─ base.ts
├─ new/
│  ├─ index.ts (extends base.ts)
├─ rename/
│  ├─ index.ts (extends base.ts)

(Basically I have two components which have exactly the same template, but different logic within the .ts/.js files)

Is it possible to specify the template path in both of those index.ts files to point to the index.hbs which is located one level above?

Or something similar, the idea is to not have to duplicate the template between those two components.

I've tried the structure above but it does not seem to work. I imagine I must specify a template path somewhere but I just can't find something like that in the documentation.




Is `store.find` function different to `store.findRecord` function on Ember JS?

There are two similar functions on Ember JS service "store". In this example they work alike.

find function

  @service store;

  async model(params) {
    return this.store.find('rental', params.rental_id);
  }

findRecord function

  @service store;

  async model(params) {
    return this.store.findRecord('rental', params.rental_id);
  }

Are they different? Or just an alias?




vendredi 9 décembre 2022

Socket hangup error while proxying my local ip using wsl

im running wsl for proxying the ember project it raising the socket hangup exception when only i use local ip of wsl by this command "cat /etc/resolv.conf" But i use remote ip like vpn's ip it will be working fine and other ip's of others working fine. when only using my local ip it throwing an eroor [enter image description here](https://ift.tt/Yteo7rPenter image description herem/yP0pw.png) see the images attached to understand my problem.

i want to run fine as i attached images when give local ip but here i gave vpn ip [enter image description here]enter image description here kindly, give any solution for this