From f64837a78c1a5bbe16a0aaa14ec7f93775baeca0 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Wed, 15 Nov 2023 10:04:37 +0100 Subject: [PATCH] Make options optional for fetch method --- src/model.js | 4 ++-- src/types/model.d.ts | 4 ++-- src/types/model.d.ts.map | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/model.js b/src/model.js index f1a8d6e..e371362 100644 --- a/src/model.js +++ b/src/model.js @@ -358,9 +358,9 @@ class Model extends EventEmitter(Object) { /** * Fetch the model from the server, merging the response with the model's * local attributes. Any changed attributes will trigger a "change" event. - * @param {Options} options + * @param {Options} [options={}] */ - fetch(options) { + fetch(options={}) { options = Object.assign({ parse: true }, options); const success = options.success; diff --git a/src/types/model.d.ts b/src/types/model.d.ts index 831bda1..01bf927 100644 --- a/src/types/model.d.ts +++ b/src/types/model.d.ts @@ -194,9 +194,9 @@ export class Model extends Model_base { /** * Fetch the model from the server, merging the response with the model's * local attributes. Any changed attributes will trigger a "change" event. - * @param {Options} options + * @param {Options} [options={}] */ - fetch(options: Options): any; + fetch(options?: Options): any; /** * Set a hash of model attributes, and sync the model to the server. * If the server returns an attributes hash that differs, the model's diff --git a/src/types/model.d.ts.map b/src/types/model.d.ts.map index a671e96..bc387df 100644 --- a/src/types/model.d.ts.map +++ b/src/types/model.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../model.js"],"names":[],"mappings":"yBAgBa,OAAO,iBAAiB,EAAE,UAAU;yBACpC,OAAQ,MAAM,EAAE,GAAG,CAAC;sBAEpB,OAAQ,MAAM,EAAE,GAAG,CAAC;2BAGpB,OAAQ,MAAM,EAAE,GAAG,CAAC;;;QAPjC;;;;;;;;;;;;WAYG;QAEH;;;;;WAKG;;;;;;;;;;;;;;AAnBH;;;;;;;;;;;;GAYG;AAEH;;;;;GAKG;AACH;IACE;;;;;OAKG;IACH,yBAHW,UAAU,YACV,YAAY,kBAyBtB;IAlBC,SAAmC;IAC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,OAAO,YACP,OAAO,WAIjB;IAED;;OAEG;IACH,iBAEC;IAED;;;OAGG;IACH,kBAFW,OAAO,WAIjB;IAED;;;;;OAKG;IACH,iBAHW,UAAU,YACV,OAAO,WASjB;CACF"} \ No newline at end of file +{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../model.js"],"names":[],"mappings":"yBAgBa,OAAO,iBAAiB,EAAE,UAAU;yBACpC,OAAQ,MAAM,EAAE,GAAG,CAAC;sBAEpB,OAAQ,MAAM,EAAE,GAAG,CAAC;2BAGpB,OAAQ,MAAM,EAAE,GAAG,CAAC;;;QAPjC;;;;;;;;;;;;WAYG;QAEH;;;;;WAKG;;;;;;;;;;;;;;AAnBH;;;;;;;;;;;;GAYG;AAEH;;;;;GAKG;AACH;IACE;;;;;OAKG;IACH,yBAHW,UAAU,YACV,YAAY,kBAyBtB;IAlBC,SAAmC;IACnC,eAAoB;IAGpB,wBAA2B;IAEH,gBAAoC;IAW5D,YAAiB;IAGnB;;OAEG;IACH,iCAEC;IAED;;OAEG;IACH,8BAEC;IARC,yBAA8B;IAUhC;;;;OAIG;IAEH,0BAEC;IAED;;;OAGG;IAEH,wBAEC;IAED;;;OAGG;IAEH,sBAAkB;IAElB;;;OAGG;IAEH,mBAAe;IAEf;;;;OAIG;IACH,gBAJW,MAAM,YACN,MAAM,GACJ,MAAM,CAIlB;IAED;;OAEG;IACH,cAEC;IAED;;;;;OAKG;IAEH,aALW,QAAQ,GAAC,QAAQ,GAAC,OAAO,GAAC,QAAQ,GAAC,MAAM,SACzC,KAAK,WACL,OAAO,OAKjB;IAED;;;OAGG;IACH,UAFW,MAAM,OAIhB;IAED,iBAEC;IAED,gBAEC;IAED,yBAEC;IAED,2BAEC;IAED,cAEC;IAED,0BAKC;IAED,0BAKC;IAED,eAEC;IAED;;;;OAIG;IACH,UAFW,MAAM,WAIhB;IAED;;;OAGG;IACH,eAFW,UAAU,WAIpB;IAED;;;;;;;OAOG;IACH,SAJW,MAAM,MAAO,OACb,M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