-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(): minor updates for next stencil version (#20787)
- Loading branch information
1 parent
7a4ddde
commit 976e68d
Showing
38 changed files
with
6,889 additions
and
6,926 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
/* eslint-disable */ | ||
/* tslint:disable */ | ||
import { fromEvent } from 'rxjs'; | ||
|
||
export const proxyInputs = (Cmp: any, inputs: string[]) => { | ||
const Prototype = Cmp.prototype; | ||
inputs.forEach(item => { | ||
Object.defineProperty(Prototype, item, { | ||
get() { | ||
return this.el[item]; | ||
}, | ||
set(val: any) { | ||
this.z.runOutsideAngular(() => (this.el[item] = val)); | ||
} | ||
}); | ||
Object.defineProperty(Prototype, item, { | ||
get() { | ||
return this.el[item]; | ||
}, | ||
set(val: any) { | ||
this.z.runOutsideAngular(() => (this.el[item] = val)); | ||
} | ||
}); | ||
}); | ||
}; | ||
|
||
export const proxyMethods = (Cmp: any, methods: string[]) => { | ||
const Prototype = Cmp.prototype; | ||
methods.forEach(methodName => { | ||
Prototype[methodName] = function () { | ||
const args = arguments; | ||
return this.z.runOutsideAngular(() => | ||
this.el[methodName].apply(this.el, args) | ||
); | ||
}; | ||
Prototype[methodName] = function () { | ||
const args = arguments; | ||
return this.z.runOutsideAngular(() => | ||
this.el[methodName].apply(this.el, args) | ||
); | ||
}; | ||
}); | ||
}; | ||
|
||
export const proxyOutputs = (instance: any, el: any, events: string[]) => { | ||
events.forEach(eventName => instance[eventName] = fromEvent(el, eventName)); | ||
} | ||
|
||
// tslint:disable-next-line: only-arrow-functions | ||
export function ProxyCmp(opts: { inputs?: any; methods?: any }) { | ||
const decorator = function(cls: any){ | ||
if (opts.inputs) { | ||
proxyInputs(cls, opts.inputs); | ||
} | ||
if (opts.methods) { | ||
proxyMethods(cls, opts.methods); | ||
} | ||
return cls; | ||
if (opts.inputs) { | ||
proxyInputs(cls, opts.inputs); | ||
} | ||
if (opts.methods) { | ||
proxyMethods(cls, opts.methods); | ||
} | ||
return cls; | ||
}; | ||
return decorator; | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
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
Oops, something went wrong.