aoye 0.0.57 → 0.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -44,9 +44,9 @@ declare enum ScheduleStatus {
44
44
 
45
45
  declare class NoopEffect {
46
46
  callback: () => OnClean | any;
47
- constructor(callback: () => OnClean | any);
47
+ constructor(callback: () => OnClean | any, _type?: any);
48
48
  }
49
- declare const noopEffect: (callback: () => OnClean | any) => Scope;
49
+ declare const noopEffect: (callback: Function, deps?: any[], _opt?: any) => Scope;
50
50
  declare class Scope {
51
51
  callback: () => OnClean | any;
52
52
  emitHead: Link;
package/dist/index.umd.js CHANGED
@@ -735,14 +735,25 @@
735
735
  }
736
736
  }
737
737
  class NoopEffect {
738
- constructor(callback) {
738
+ constructor(callback, _type) {
739
739
  this.callback = callback;
740
740
  const scope = new Scope(callback);
741
741
  scope.get();
742
742
  return scope;
743
743
  }
744
744
  }
745
- const noopEffect = callback => {
745
+ const noopEffect = (callback, deps, _opt) => {
746
+ if (deps && deps.length > 0) {
747
+ const scope = new Scope(() => {
748
+ const vs = deps.map(d => ({
749
+ old: undefined,
750
+ val: typeof d === 'function' ? d() : d.get()
751
+ }));
752
+ callback(...vs);
753
+ });
754
+ scope.get();
755
+ return scope;
756
+ }
746
757
  const scope = new Scope(callback);
747
758
  scope.get();
748
759
  return scope;