issues with usage of window

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

issues with usage of window

Amber Smalltalk mailing list
Hi!

I am not able to implement a working version of the js code in amber.

I installed the 0.14 version today and created a project with amber init.
All default stuff though.

window.URL = window.URL || window.webkitURL || window.mozURL ||
window.msURL;

I tried to inline the code and I tried to stay all in amber...

How would you try it?

Thanks
Sebastian

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: issues with usage of window

Herby Vojčík
window at: 'URL' put: (URL ifNil: [ webKitUrl ifNil: [ mozUrl ifNil: [ msURL ]]])

'Sebastian Heidbrink' via amber-lang wrote:

> Hi!
>
> I am not able to implement a working version of the js code in amber.
>
> I installed the 0.14 version today and created a project with amber init.
> All default stuff though.
>
> window.URL = window.URL || window.webkitURL || window.mozURL ||
> window.msURL;
>
> I tried to inline the code and I tried to stay all in amber...
>
> How would you try it?
>
> Thanks
> Sebastian
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: issues with usage of window

Herby Vojčík


Herby Vojčík wrote:
> window at: 'URL' put: (URL ifNil: [ webKitUrl ifNil: [ mozUrl ifNil: [
> msURL ]]])

Maybe even this would, which is safer, if there is Smalltalk class URL, and maybe nicer:

window at: 'URL' ifAbsentPut: [ webKitUrl ifNil: [ mozUrl ifNil: [ msURL ]]]

I don't know now if JSObjectProxy has at:ifAbsentPut: implemented.

> 'Sebastian Heidbrink' via amber-lang wrote:
>> Hi!
>>
>> I am not able to implement a working version of the js code in amber.
>>
>> I installed the 0.14 version today and created a project with amber
>> init.
>> All default stuff though.
>>
>> window.URL = window.URL || window.webkitURL || window.mozURL ||
>> window.msURL;
>>
>> I tried to inline the code and I tried to stay all in amber...
>>
>> How would you try it?
>>
>> Thanks
>> Sebastian
>>
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: issues with usage of window

Amber Smalltalk mailing list
Hi Herby,

thank you for your suggestions. Unfotunately non of them work either.

I somehow have trouble to chech whether a jsObject understands a
particular method.

The only way to accomplish that is a simple and stupid:

(jsObject at: 'myMethod' ) ifNil: [^self].


How do you usually chech on browser based differences like moz, webKit,
ms,....

Sebastian




Am 06.01.2015 um 03:16 schrieb Herby Vojčík:

>
>
> Herby Vojčík wrote:
>> window at: 'URL' put: (URL ifNil: [ webKitUrl ifNil: [ mozUrl ifNil:
>> [ msURL ]]])
>
> Maybe even this would, which is safer, if there is Smalltalk class
> URL, and maybe nicer:
>
> window at: 'URL' ifAbsentPut: [ webKitUrl ifNil: [ mozUrl ifNil: [
> msURL ]]]
>
> I don't know now if JSObjectProxy has at:ifAbsentPut: implemented.
>
>> 'Sebastian Heidbrink' via amber-lang wrote:
>>> Hi!
>>>
>>> I am not able to implement a working version of the js code in amber.
>>>
>>> I installed the 0.14 version today and created a project with amber
>>> init.
>>> All default stuff though.
>>>
>>> window.URL = window.URL || window.webkitURL || window.mozURL ||
>>> window.msURL;
>>>
>>> I tried to inline the code and I tried to stay all in amber...
>>>
>>> How would you try it?
>>>
>>> Thanks
>>> Sebastian
>>>
>>
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: issues with usage of window

Herby Vojčík
oh yeah, this is the case where you need to use window.foo to eschew ReferenceError... well, use JS method. Or you can try to get the value as:

window at: 'URL' ifAbsent: [
window at: 'webkitUrl' ifAbsent: [
...
]]]]

and then at:put: it at 'URL'.

'Sebastian Heidbrink' via amber-lang wrote:

> Hi Herby,
>
> thank you for your suggestions. Unfotunately non of them work either.
>
> I somehow have trouble to chech whether a jsObject understands a
> particular method.
>
> The only way to accomplish that is a simple and stupid:
>
> (jsObject at: 'myMethod' ) ifNil: [^self].
>
>
> How do you usually chech on browser based differences like moz,
> webKit, ms,....
>
> Sebastian
>
>
>
>
> Am 06.01.2015 um 03:16 schrieb Herby Vojčík:
>>
>>
>> Herby Vojčík wrote:
>>> window at: 'URL' put: (URL ifNil: [ webKitUrl ifNil: [ mozUrl ifNil:
>>> [ msURL ]]])
>>
>> Maybe even this would, which is safer, if there is Smalltalk class
>> URL, and maybe nicer:
>>
>> window at: 'URL' ifAbsent
Put: [ webKitUrl ifNil: [ mozUrl ifNil: [

>> msURL ]]]
>>
>> I don't know now if JSObjectProxy has at:ifAbsentPut: implemented.
>>
>>> 'Sebastian Heidbrink' via amber-lang wrote:
>>>> Hi!
>>>>
>>>> I am not able to implement a working version of the js code in amber.
>>>>
>>>> I installed the 0.14 version today and created a project with amber
>>>> init.
>>>> All default stuff though.
>>>>
>>>> window.URL = window.URL || window.webkitURL || window.mozURL ||
>>>> window.msURL;
>>>>
>>>> I tried to inline the code and I tried to stay all in amber...
>>>>
>>>> How would you try it?
>>>>
>>>> Thanks
>>>> Sebastian
>>>>
>>>
>>
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: issues with usage of window

Amber Smalltalk mailing list
Yes that works!  But now the next problem.

URL is a function and I need to do this:

objectURL = URL.createObjectURL(blob);

This means I need to:

  NativeFunction constructor: 'window.URL'

But this leads to the error that the constructor is missing an argument.

If I pass an argument the result is a objectURL but I need an instance
of URL Function... Is there a different constructor or mechanism to use?

Sebastian

Am 06.01.2015 um 14:05 schrieb Herby Vojčík:

> oh yeah, this is the case where you need to use window.foo to eschew
> ReferenceError... well, use JS method. Or you can try to get the value
> as:
>
> window at: 'URL' ifAbsent: [
> window at: 'webkitUrl' ifAbsent: [
> ...
> ]]]]
>
> and then at:put: it at 'URL'.
>
> 'Sebastian Heidbrink' via amber-lang wrote:
>> Hi Herby,
>>
>> thank you for your suggestions. Unfotunately non of them work either.
>>
>> I somehow have trouble to chech whether a jsObject understands a
>> particular method.
>>
>> The only way to accomplish that is a simple and stupid:
>>
>> (jsObject at: 'myMethod' ) ifNil: [^self].
>>
>>
>> How do you usually chech on browser based differences like moz,
>> webKit, ms,....
>>
>> Sebastian
>>
>>
>>
>>
>> Am 06.01.2015 um 03:16 schrieb Herby Vojčík:
>>>
>>>
>>> Herby Vojčík wrote:
>>>> window at: 'URL' put: (URL ifNil: [ webKitUrl ifNil: [ mozUrl
>>>> ifNil: [ msURL ]]])
>>>
>>> Maybe even this would, which is safer, if there is Smalltalk class
>>> URL, and maybe nicer:
>>>
>>> window at: 'URL' ifAbsent
> Put: [ webKitUrl ifNil: [ mozUrl ifNil: [
>>> msURL ]]]
>>>
>>> I don't know now if JSObjectProxy has at:ifAbsentPut: implemented.
>>>
>>>> 'Sebastian Heidbrink' via amber-lang wrote:
>>>>> Hi!
>>>>>
>>>>> I am not able to implement a working version of the js code in amber.
>>>>>
>>>>> I installed the 0.14 version today and created a project with
>>>>> amber init.
>>>>> All default stuff though.
>>>>>
>>>>> window.URL = window.URL || window.webkitURL || window.mozURL ||
>>>>> window.msURL;
>>>>>
>>>>> I tried to inline the code and I tried to stay all in amber...
>>>>>
>>>>> How would you try it?
>>>>>
>>>>> Thanks
>>>>> Sebastian
>>>>>
>>>>
>>>
>>
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: issues with usage of window

Bert Freudenberg
You can directly call that function. See

https://github.com/amber-smalltalk/amber/wiki/From-smalltalk-to-javascript-and-back

- Bert -

On 07.01.2015, at 00:25, 'Sebastian Heidbrink' via amber-lang <[hidden email]> wrote:

>
> Yes that works!  But now the next problem.
>
> URL is a function and I need to do this:
>
> objectURL = URL.createObjectURL(blob);
>
> This means I need to:
>
> NativeFunction constructor: 'window.URL'
>
> But this leads to the error that the constructor is missing an argument.
>
> If I pass an argument the result is a objectURL but I need an instance of URL Function... Is there a different constructor or mechanism to use?
>
> Sebastian
>
> Am 06.01.2015 um 14:05 schrieb Herby Vojčík:
>> oh yeah, this is the case where you need to use window.foo to eschew ReferenceError... well, use JS method. Or you can try to get the value as:
>>
>> window at: 'URL' ifAbsent: [
>> window at: 'webkitUrl' ifAbsent: [
>> ...
>> ]]]]
>>
>> and then at:put: it at 'URL'.
>>
>> 'Sebastian Heidbrink' via amber-lang wrote:
>>> Hi Herby,
>>>
>>> thank you for your suggestions. Unfotunately non of them work either.
>>>
>>> I somehow have trouble to chech whether a jsObject understands a particular method.
>>>
>>> The only way to accomplish that is a simple and stupid:
>>>
>>> (jsObject at: 'myMethod' ) ifNil: [^self].
>>>
>>>
>>> How do you usually chech on browser based differences like moz, webKit, ms,....
>>>
>>> Sebastian
>>>
>>>
>>>
>>>
>>> Am 06.01.2015 um 03:16 schrieb Herby Vojčík:
>>>>
>>>>
>>>> Herby Vojčík wrote:
>>>>> window at: 'URL' put: (URL ifNil: [ webKitUrl ifNil: [ mozUrl ifNil: [ msURL ]]])
>>>>
>>>> Maybe even this would, which is safer, if there is Smalltalk class URL, and maybe nicer:
>>>>
>>>> window at: 'URL' ifAbsent
>> Put: [ webKitUrl ifNil: [ mozUrl ifNil: [
>>>> msURL ]]]
>>>>
>>>> I don't know now if JSObjectProxy has at:ifAbsentPut: implemented.
>>>>
>>>>> 'Sebastian Heidbrink' via amber-lang wrote:
>>>>>> Hi!
>>>>>>
>>>>>> I am not able to implement a working version of the js code in amber.
>>>>>>
>>>>>> I installed the 0.14 version today and created a project with amber init.
>>>>>> All default stuff though.
>>>>>>
>>>>>> window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;
>>>>>>
>>>>>> I tried to inline the code and I tried to stay all in amber...
>>>>>>
>>>>>> How would you try it?
>>>>>>
>>>>>> Thanks
>>>>>> Sebastian
>>>>>>
>>>>>
>>>>
>>>
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: issues with usage of window

Amber Smalltalk mailing list
oooohhhh right! Thank you, Bert!

I was to into the window at: issue that I lost focus.
in chrome I still have trouble but at least it behaved like expected now.

Well, just in case somebody might beinterested in it, I published some
video stuff and will extend it step by step.

Would be great to have a Helios video chat plug in...

https://github.com/HeSe/amber-video

Sebastian




Am 06.01.2015 um 15:29 schrieb Bert Freudenberg:

> You can directly call that function. See
>
> https://github.com/amber-smalltalk/amber/wiki/From-smalltalk-to-javascript-and-back
>
> - Bert -
>
> On 07.01.2015, at 00:25, 'Sebastian Heidbrink' via amber-lang <[hidden email]> wrote:
>> Yes that works!  But now the next problem.
>>
>> URL is a function and I need to do this:
>>
>> objectURL = URL.createObjectURL(blob);
>>
>> This means I need to:
>>
>> NativeFunction constructor: 'window.URL'
>>
>> But this leads to the error that the constructor is missing an argument.
>>
>> If I pass an argument the result is a objectURL but I need an instance of URL Function... Is there a different constructor or mechanism to use?
>>
>> Sebastian
>>
>> Am 06.01.2015 um 14:05 schrieb Herby Vojčík:
>>> oh yeah, this is the case where you need to use window.foo to eschew ReferenceError... well, use JS method. Or you can try to get the value as:
>>>
>>> window at: 'URL' ifAbsent: [
>>> window at: 'webkitUrl' ifAbsent: [
>>> ...
>>> ]]]]
>>>
>>> and then at:put: it at 'URL'.
>>>
>>> 'Sebastian Heidbrink' via amber-lang wrote:
>>>> Hi Herby,
>>>>
>>>> thank you for your suggestions. Unfotunately non of them work either.
>>>>
>>>> I somehow have trouble to chech whether a jsObject understands a particular method.
>>>>
>>>> The only way to accomplish that is a simple and stupid:
>>>>
>>>> (jsObject at: 'myMethod' ) ifNil: [^self].
>>>>
>>>>
>>>> How do you usually chech on browser based differences like moz, webKit, ms,....
>>>>
>>>> Sebastian
>>>>
>>>>
>>>>
>>>>
>>>> Am 06.01.2015 um 03:16 schrieb Herby Vojčík:
>>>>>
>>>>> Herby Vojčík wrote:
>>>>>> window at: 'URL' put: (URL ifNil: [ webKitUrl ifNil: [ mozUrl ifNil: [ msURL ]]])
>>>>> Maybe even this would, which is safer, if there is Smalltalk class URL, and maybe nicer:
>>>>>
>>>>> window at: 'URL' ifAbsent
>>> Put: [ webKitUrl ifNil: [ mozUrl ifNil: [
>>>>> msURL ]]]
>>>>>
>>>>> I don't know now if JSObjectProxy has at:ifAbsentPut: implemented.
>>>>>
>>>>>> 'Sebastian Heidbrink' via amber-lang wrote:
>>>>>>> Hi!
>>>>>>>
>>>>>>> I am not able to implement a working version of the js code in amber.
>>>>>>>
>>>>>>> I installed the 0.14 version today and created a project with amber init.
>>>>>>> All default stuff though.
>>>>>>>
>>>>>>> window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;
>>>>>>>
>>>>>>> I tried to inline the code and I tried to stay all in amber...
>>>>>>>
>>>>>>> How would you try it?
>>>>>>>
>>>>>>> Thanks
>>>>>>> Sebastian
>>>>>>>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.