-
-
Save DanaKirsh/324822122b0d791f1c8ee2ad96f94ca6 to your computer and use it in GitHub Desktop.
prototype pollution
This file contains 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 RESTAdapter from 'ember-data/adapters/rest'; | |
export default class extends RESTAdapter { | |
ajax(path, method, options) { | |
return { | |
myModels: [{ | |
id: 1, | |
name: 'Model 1' | |
}] | |
}; | |
} | |
} |
This file contains 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 { | |
appName = 'Ember Twiddle'; | |
} |
This file contains 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 Model from 'ember-data/model'; | |
/* | |
import attr from 'ember-data/attr'; | |
import { belongsTo, hasMany } from 'ember-data/relationships'; | |
*/ | |
export default class extends Model { | |
} |
This file contains 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 Route from '@ember/routing/route'; | |
import { inject } from '@ember/service'; | |
import { A as emberA } from '@ember/array'; | |
export default class extends Route { | |
@inject store; | |
model() { | |
return this.store.findAll('my-model'); | |
} | |
setupController(controller, model) { | |
const recordArray = model; | |
const emberArray = emberA(); | |
const nativeArray = []; | |
console.log('the arrays...'); | |
console.log('record array', recordArray); | |
console.log(recordArray.name) | |
console.log('ember array', emberArray); | |
console.log(emberArray.name) | |
console.log('native array', nativeArray); | |
console.log(nativeArray.name) | |
console.log(''); | |
console.log('do they have kvo methods?...'); | |
console.log('record array', !!recordArray.pushObject); | |
console.log('ember array', !!emberArray.pushObject); | |
console.log('native array', !!nativeArray.pushObject); | |
console.log(''); | |
console.log('do they have kvo methods after slicing?'); | |
console.log(!!recordArray.slice()) | |
console.log('record array', !!recordArray.slice().pushObject); | |
console.log('^ one would expect this to be false'); | |
} | |
} |
This file contains 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
{ | |
"version": "0.17.1", | |
"EmberENV": { | |
"EXTEND_PROTOTYPES": false, | |
"FEATURES": {}, | |
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": false, | |
"_APPLICATION_TEMPLATE_WRAPPER": true, | |
"_JQUERY_INTEGRATION": true | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js", | |
"ember": "3.18.1", | |
"ember-template-compiler": "3.18.1", | |
"ember-testing": "3.18.1" | |
}, | |
"addons": { | |
"@glimmer/component": "1.0.0", | |
"ember-data": "3.18.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment